Skip to content

Commit

Permalink
[test] further testing of buit-in immc benchmarks
Browse files Browse the repository at this point in the history
  • Loading branch information
fangq committed Mar 10, 2024
1 parent 8e44f67 commit 237713b
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 4 deletions.
2 changes: 1 addition & 1 deletion examples/validation/createmesh.m
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@
elem(:, 1:4) = meshreorient(node, elem(:, 1:4));

srcpos = [30.1, 30.2, 0];
savemmcmesh(sessionid, node, elem, []);
savemmcmesh(sessionid, node, elem);
eid = tsearchn(node, elem(:, 1:4), srcpos);
4 changes: 2 additions & 2 deletions src/mmc_bench.c
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ MSTR(
"DoMismatch":1,
"DebugFlag":"TP",
"RayTracer":"g",
"OutputFormat": "bin",
"OutputFormat": "bin",
"Photons":1e6
},
"Domain":{
Expand Down Expand Up @@ -365,7 +365,7 @@ MSTR(
"DoMismatch":1,
"DebugFlag":"TP",
"RayTracer":"g",
"OutputFormat": "bin",
"OutputFormat": "bin",
"Photons":1e6
},
"Domain":{
Expand Down
16 changes: 15 additions & 1 deletion src/mmc_cu_host.cu
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,18 @@ and the ray tracer precomputed data (tracer).
******************************************************************************/
#define CUDA_ASSERT(a) \
mcx_cu_assess((a), __FILE__, __LINE__) ///< macro to report CUDA error

/**
* @brief Utility function to calculate the GPU stream processors (cores) per SM
*
* Obtain GPU core number per MP, this replaces
* ConvertSMVer2Cores() in libcudautils to avoid
* extra dependency.
*
* @param[in] v1: the major version of an NVIDIA GPU
* @param[in] v2: the minor version of an NVIDIA GPU
*/

int mcx_corecount(int v1, int v2) {
int v = v1 * 10 + v2;

Expand All @@ -62,8 +74,10 @@ int mcx_corecount(int v1, int v2) {
return 48;
} else if (v < 50) {
return 192;
} else {
} else if (v < 60 || v == 61 || v >= 89) {
return 128;
} else {
return 64;
}
}

Expand Down
9 changes: 9 additions & 0 deletions src/mmc_utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -1381,6 +1381,7 @@ int mcx_loadjson(cJSON* root, mcconfig* cfg) {

cfg->roitype = (collen == 6) ? rtEdge : ((collen == 1 || rowlen == 1) ? rtNode : (collen == 4 ? rtFace : rtNone));
cfg->roidata = (float*)malloc(sizeof(float) * rowlen * collen);
cfg->implicit = (cfg->roitype != rtNone) + (cfg->roitype == rtFace);

for (int i = 0; i < rowlen; i++) {
if (cJSON_GetArraySize(subitem) != collen) {
Expand Down Expand Up @@ -2830,6 +2831,14 @@ void mcx_validatecfg(mcconfig* cfg) {
cfg->basisorder = 0;
}

if (cfg->implicit && (int)(cfg->gpuid) >= 0) {
MMC_ERROR(-2, "Implicit MMC is currently only supported in the CPU, please set -G -1 or cfg.gpuid=-1");
}

if (cfg->srcnum > 1 && (int)(cfg->gpuid) >= 0) {
MMC_ERROR(-2, "Photon-sharing MMC is currently only supported in the CPU, please set -G -1 or cfg.gpuid=-1");
}

for (i = 0; i < MAX_DEVICE; i++)
if (cfg->deviceid[i] == '0') {
cfg->deviceid[i] = '\0';
Expand Down

0 comments on commit 237713b

Please sign in to comment.