MCPcopy Create free account
hub / github.com/NVIDIA/cuda-samples / runAutoTest

Function runAutoTest

cpp/5_Domain_Specific/marchingCubes/marchingCubes.cpp:351–400  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

349}
350
351void runAutoTest(int argc, char **argv)
352{
353 findCudaDevice(argc, (const char **)argv);
354
355 // Initialize CUDA buffers for Marching Cubes
356 initMC(argc, argv);
357
358 computeIsosurface();
359
360 char *ref_file = NULL;
361 getCmdLineArgumentString(argc, (const char **)argv, "file", &ref_file);
362
363 enum DUMP_TYPE { DUMP_POS = 0, DUMP_NORMAL, DUMP_VOXEL };
364 int dump_option = getCmdLineArgumentInt(argc, (const char **)argv, "dump");
365
366 bool bTestResult = true;
367
368 switch (dump_option) {
369 case DUMP_POS:
370 dumpFile((void *)d_pos, sizeof(float4) * maxVerts, "marchCube_posArray.bin");
371 bTestResult = sdkCompareBin2BinFloat(
372 "marchCube_posArray.bin", "posArray.bin", maxVerts * sizeof(float) * 4, EPSILON, THRESHOLD, argv[0]);
373 break;
374
375 case DUMP_NORMAL:
376 dumpFile((void *)d_normal, sizeof(float4) * maxVerts, "marchCube_normalArray.bin");
377 bTestResult = sdkCompareBin2BinFloat(
378 "marchCube_normalArray.bin", "normalArray.bin", maxVerts * sizeof(float) * 4, EPSILON, THRESHOLD, argv[0]);
379 break;
380
381 case DUMP_VOXEL:
382 dumpFile((void *)d_compVoxelArray, sizeof(uint) * numVoxels, "marchCube_compVoxelArray.bin");
383 bTestResult = sdkCompareBin2BinFloat("marchCube_compVoxelArray.bin",
384 "compVoxelArray.bin",
385 numVoxels * sizeof(uint),
386 EPSILON,
387 THRESHOLD,
388 argv[0]);
389 break;
390
391 default:
392 printf("Invalid validation flag!\n");
393 printf("-dump=0 <check position>\n");
394 printf("-dump=1 <check normal>\n");
395 printf("-dump=2 <check voxel>\n");
396 exit(EXIT_SUCCESS);
397 }
398
399 exit(bTestResult ? EXIT_SUCCESS : EXIT_FAILURE);
400}
401
402////////////////////////////////////////////////////////////////////////////////
403// Program main

Callers 1

mainFunction · 0.70

Calls 7

findCudaDeviceFunction · 0.85
initMCFunction · 0.85
computeIsosurfaceFunction · 0.85
getCmdLineArgumentStringFunction · 0.85
getCmdLineArgumentIntFunction · 0.85
dumpFileFunction · 0.85
sdkCompareBin2BinFloatFunction · 0.85

Tested by

no test coverage detected