int main (int argc, char *argv[]) { struct GNUNET_CRYPTO_EccDlogContext *edc; if (! gcry_check_version ("1.6.0")) { FPRINTF (stderr, _ ("libgcrypt has not the expected version (version %s is required).\n"), "1.6.0"); return 0; } if (getenv ("GNUNET_GCRYPT_DEBUG")) gcry_control (GCRYCTL_SET_DEBUG_FLAGS, 1u , 0); GNUNET_log_setup ("test-crypto-ecc-dlog", "WARNING", NULL); edc = GNUNET_CRYPTO_ecc_dlog_prepare (MAX_FACT, MAX_MEM); test_dlog (edc); test_math (edc); GNUNET_CRYPTO_ecc_dlog_release (edc); return 0; }
int main(int argc, char **argv) { int ret = 0; ret |= test_hash(); ret |= test_log(); ret |= test_math(); return ret; }
int main() { puts("Testing mathematics..."); test_math(); puts("OK!"); puts("Testing comparisons..."); test_comp(); puts("OK!"); puts("Testing comparisons..."); test_array_struct(); puts("OK!"); puts("Testing string library..."); test_lib_string(); puts("OK!"); puts("Testing alu errors..."); test_alu_errors(); puts("OK!"); puts("Testing assert, standard & setjmp library..."); test_lib_std_setjmp(); puts("OK!"); puts("Testing I/O library"); test_lib_io(); puts("OK!"); puts("Testing trap instruction..."); test_trap(); puts("OK!"); puts("Testing out of memory protection..."); test_oom(); puts("OK!"); puts("No errors found"); return 0; }
int main(int argc, char **argv) { if (argc > 1) { if (!strcmp(argv[1], "v")) { Verbose = 1; } else if (!strcmp(argv[1], "test-stdout")) { test_stdout(); return EXIT_SUCCESS; } if (!strcmp(argv[1], "test-atexit")) { test_atexit(); return EXIT_SUCCESS; } } test_mem(); test_str(); test_sprintf(); test_math(); test_proc(); test_stdio(); test_file(); test_exit(); return EXIT_FAILURE; }
int _tmain(int argc, _TCHAR* argv[]) { LOG_F("xTest main(), 测试 \n"); int arg = 1018; switch(arg) { case 1000: { test_util_ex(); }break; case 1: { test_util(); }break; case 2: { test_container(); }break; case 3: { test_thread(); }break; case 4: { test_net(true); }break; case 5: { test_boost(); }break; case 6: { test_kbe(); }break; case 1001: { test_db(); }break; case 1002: { test_math(); }break; case 1003: { test_design(); }break; case 1005: { //test_net(false); test_async(true); }break; case 1006: { test_lua(); }break; case 1007: { test_js(); }break; case 1008: { test_proto(); }break; case 1010: { test_graph(); }break; case 1011: { test_graph_d3d(); }break; case 1013: { test_cv(); }break; case 1015: { test_battle(); }break; case 1016: { test_hacker(); }break; case 1017: { test_yh(); }break; case 1018: { test_ai(); } case 1900: { test_tool(); }break; default: { MainEx(argc, argv); }break; } // { // int n = X::Init(NULL); // LOGD_F(" n = %d", n); // // X_HSER->Init(); // X_HSER->Start(); // // X_HSER->Stop(); // X_HSER->Destroy(); // } // { // // [4/26/2015 Administrator] // HINSTANCE hnst=LoadLibrary(_T("xService.dll")); // FreeLibrary(hnst); // // HINSTANCE hnst2=LoadLibrary(_T("xService.dll")); // FreeLibrary(hnst); // // } LOG_F("xTest main(), end"); while(true) { X::Sleep_f(1); } return 0; }
int main(int argc, char **argv) { //data CUdeviceptr d_data0 = 0; CUdeviceptr d_data1 = 0; DataStruct *h_data0 = 0; DataStruct *h_data1 = 0; DataStruct h_data_reference0; DataStruct h_data_reference1; unsigned int memSize = sizeof(DataStruct); //device references CUcontext hContext = 0; CUdevice hDevice = 0; CUmodule hModule = 0; CUstream hStream = 0; // Initialize the device and get a handle to the kernel CUresult status = initialize(0, &hContext, &hDevice, &hModule, &hStream); // Allocate memory on host and device if ((h_data0 = (DataStruct *)malloc(memSize)) == NULL) { std::cerr << "Could not allocate host memory" << std::endl; exit(-1); } status = cuMemAlloc(&d_data0, memSize); if ((h_data1 = (DataStruct *)malloc(memSize)) == NULL) { std::cerr << "Could not allocate host memory" << std::endl; exit(-1); } status = cuMemAlloc(&d_data1, memSize); if (status != CUDA_SUCCESS) printf("ERROR: during cuMemAlloc\n"); /////////////////////////////////////////////////////////////////////////////// //======================= test cases ========================================// /////////////////////////////////////////////////////////////////////////////// std::string name = ""; unsigned int testnum=0; unsigned int passed=0; //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ /////////////////////// Ralf /////////////////////////////////////////////////// //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ if(runRalfFunction("test_phi_scalar", test_phi_scalar, &hModule, d_data0, h_data0, &h_data_reference0, memSize)) passed++; testnum++; if(runRalfFunction("test_phi2_scalar", test_phi2_scalar, &hModule, d_data0, h_data0, &h_data_reference0, memSize)) passed++; testnum++; if(runRalfFunction("test_phi3_scalar", test_phi3_scalar, &hModule, d_data0, h_data0, &h_data_reference0, memSize)) passed++; testnum++; if(runRalfFunction("test_phi4_scalar", test_phi4_scalar, &hModule, d_data0, h_data0, &h_data_reference0, memSize)) passed++; testnum++; if(runRalfFunction("test_phi5_scalar", test_phi5_scalar, &hModule, d_data0, h_data0, &h_data_reference0, memSize)) passed++; testnum++; if(runRalfFunction("test_phi6_scalar", test_phi6_scalar, &hModule, d_data0, h_data0, &h_data_reference0, memSize)) passed++; testnum++; if(runRalfFunction("test_phi7_scalar", test_phi7_scalar, &hModule, d_data0, h_data0, &h_data_reference0, memSize)) passed++; testnum++; if(runRalfFunction("test_phi8_scalar", test_phi8_scalar, &hModule, d_data0, h_data0, &h_data_reference0, memSize)) passed++; testnum++; if(runRalfFunction("test_phi9_scalar", test_phi9_scalar, &hModule, d_data0, h_data0, &h_data_reference0, memSize)) passed++; testnum++; if(runRalfFunction("test_loopbad_scalar", test_loopbad_scalar, &hModule, d_data0, h_data0, &h_data_reference0, memSize)) passed++; testnum++; if(runRalfFunction("test_loop23_scalar", test_loop23_scalar, &hModule, d_data0, h_data0, &h_data_reference0, memSize)) passed++; testnum++; if(runRalfFunction("test_loop13_scalar", test_loop13_scalar, &hModule, d_data0, h_data0, &h_data_reference0, memSize)) passed++; testnum++; //////////////////////////////////////////////////////////////////////////////////////////////////// /*///////////////*/ name = "test_GetElementPointer_constant"; ///////////////////// setZero(h_data0,&h_data_reference0); std::cout << "=============== Test " << testnum << ": " << name << " ===================\n"; loadAndRunTestFunction(&hModule, name, d_data0, h_data0, memSize); //run device function test_GetElementPointer_constant(&h_data_reference0); //run host reference if(compareData(h_data0,&h_data_reference0)) //compare Data {passed++; std::cout << " => Test passed!!!\n";} testnum++; /////////////////////////////////////////////////////////////////////////////////// /*///////////////*/ name = "test_calculate"; ///////////////////// setZero(h_data0,&h_data_reference0); h_data0->i = h_data_reference0.i = 3; h_data0->f = h_data_reference0.f = 3.2; std::cout << "=============== Test " << testnum << ": " << name << " ===================\n"; loadAndRunTestFunction(&hModule, name, d_data0, h_data0, memSize); //run device function test_calculate(&h_data_reference0); //run host reference if(compareData(h_data0,&h_data_reference0)) //compare Data {passed++; std::cout << " => Test passed!!!\n";} testnum++; /////////////////////////////////////////////////////////////////////////////////////////////// /*///////////////*/ name = "test_parquetShader"; ///////////////////// setZero(h_data0,&h_data_reference0); h_data0->f = h_data_reference0.f = 1; std::cout << "=============== Test " << testnum << ": " << name << " ===================\n"; loadAndRunTestFunction(&hModule, name, d_data0, h_data0, memSize); //run device function test_parquetShader(&h_data_reference0); //run host reference if(compareData(h_data0,&h_data_reference0)) //compare Data {passed++; std::cout << " => Test passed!!!\n";} testnum++; /////////////////////////////////////////////////////////////////////////////////////////////// /*///////////////*/ name = "test_GetElementPointer_dyn"; ///////////////////// setZero(h_data0,&h_data_reference0); h_data0->i = h_data_reference0.i = 3; h_data0->u = h_data_reference0.u = 7; std::cout << "=============== Test " << testnum << ": " << name << " ===================\n"; loadAndRunTestFunction(&hModule, name, d_data0, h_data0, memSize); //run device function test_GetElementPointer_dyn(&h_data_reference0); //run host reference if(compareData(h_data0,&h_data_reference0)) //compare Data {passed++; std::cout << " => Test passed!!!\n";} testnum++; /////////////////////////////////////////////////////////////////////////////////////////////// /*///////////////*/ name = "test_branch_simple"; // Branch 1 ///////////////// setZero(h_data0,&h_data_reference0); h_data0->f = h_data_reference0.f = -4; std::cout << "=============== Test " << testnum << ": " << name << " ===================\n"; loadAndRunTestFunction(&hModule, name, d_data0, h_data0, memSize); //run device function test_branch_simple(&h_data_reference0); //run host reference if(compareData(h_data0,&h_data_reference0)) //compare Data {passed++; std::cout << " => Test passed!!!\n";} testnum++; /////////////////////////////////////////////////////////////////////////////////////////////// /*///////////////*/ name = "test_branch_simple"; // Branch 2 ///////////////// setZero(h_data0,&h_data_reference0); h_data0->f = h_data_reference0.f = 8; std::cout << "=============== Test " << testnum << ": " << name << " ===================\n"; loadAndRunTestFunction(&hModule, name, d_data0, h_data0, memSize); //run device function test_branch_simple(&h_data_reference0); //run host reference if(compareData(h_data0,&h_data_reference0)) //compare Data {passed++; std::cout << " => Test passed!!!\n";} testnum++; ////////////////////////////////////////////////////////////////////////////////////////////////// /*///////////////*/ name = "test_branch_simplePHI"; // Branch 1 ///////////////// setZero(h_data0,&h_data_reference0); h_data0->f = h_data_reference0.f = -10; std::cout << "=============== Test " << testnum << ": " << name << " ===================\n"; loadAndRunTestFunction(&hModule, name, d_data0, h_data0, memSize); //run device function test_branch_simplePHI(&h_data_reference0); //run host reference if(compareData(h_data0,&h_data_reference0)) //compare Data {passed++; std::cout << " => Test passed!!!\n";} testnum++; ////////////////////////////////////////////////////////////////////////////////////////////////// /*///////////////*/ name = "test_branch_loop"; ////////////////////////////////// setZero(h_data0,&h_data_reference0); h_data0->i = h_data_reference0.i = 100; std::cout << "=============== Test " << testnum << ": " << name << " ===================\n"; loadAndRunTestFunction(&hModule, name, d_data0, h_data0, memSize); //run device function test_branch_loop(&h_data_reference0); //run host reference if(compareData(h_data0,&h_data_reference0)) //compare Data {passed++; std::cout << " => Test passed!!!\n";} testnum++; ////////////////////////////////////////////////////////////////////////////////////////////////// /*///////////////*/ name = "test_math"; ////////////////////////////////////////// setZero(h_data0,&h_data_reference0); h_data0->f = h_data_reference0.f = 1.4; h_data0->i = h_data_reference0.i = 3; std::cout << "=============== Test " << testnum << ": " << name << " ===================\n"; loadAndRunTestFunction(&hModule, name, d_data0, h_data0, memSize); //run device function test_math(&h_data_reference0); //run host reference if(compareData(h_data0,&h_data_reference0)) //compare Data {passed++; std::cout << " => Test passed!!!\n";} testnum++; ////////////////////////////////////////////////////////////////////////////////////////////////// /*///////////////*/ name = "test_signedOperands"; ////////////////////////////////////////// setZero(h_data0,&h_data_reference0); h_data0->i = h_data_reference0.i = 3; h_data0->f = h_data_reference0.f = -7; std::cout << "=============== Test " << testnum << ": " << name << " ===================\n"; loadAndRunTestFunction(&hModule, name, d_data0, h_data0, memSize); //run device function test_signedOperands(&h_data_reference0); //run host reference if(compareData(h_data0,&h_data_reference0)) //compare Data {passed++; std::cout << " => Test passed!!!\n";} testnum++; ////////////////////////////////////////////////////////////////////////////////////////////////// /*///////////////*/ name = "test_constantOperands"; ////////////////////////////////////////// setZero(h_data0,&h_data_reference0); h_data0->i = h_data_reference0.i = 3; h_data0->f = h_data_reference0.f = -1.44; std::cout << "=============== Test " << testnum << ": " << name << " ===================\n"; loadAndRunTestFunction(&hModule, name, d_data0, h_data0, memSize); //run device function test_constantOperands(&h_data_reference0); //run host reference if(compareData(h_data0,&h_data_reference0)) //compare Data {passed++; std::cout << " => Test passed!!!\n";} testnum++; ////////////////////////////////////////////////////////////////////////////////////////////////// /*///////////////*/ name = "test_branch_loop_semihard"; ///////////////////////// setZero(h_data0,&h_data_reference0); h_data0->i = h_data_reference0.i = 10; std::cout << "=============== Test " << testnum << ": " << name << " ===================\n"; loadAndRunTestFunction(&hModule, name, d_data0, h_data0, memSize); //run device function test_branch_loop_semihard(&h_data_reference0); //run host reference if(compareData(h_data0,&h_data_reference0)) //compare Data {passed++; std::cout << " => Test passed!!!\n";} testnum++; ////////////////////////////////////////////////////////////////////////////////////////////////// /*///////////////*/ name = "test_branch_loop_hard"; // Branch 1 ///////////////// setZero(h_data0,&h_data_reference0); h_data0->i = h_data_reference0.i = 1; h_data0->u = h_data_reference0.u = 3; std::cout << "=============== Test " << testnum << ": " << name << " ===================\n"; loadAndRunTestFunction(&hModule, name, d_data0, h_data0, memSize); //run device function test_branch_loop_hard(&h_data_reference0); //run host reference if(compareData(h_data0,&h_data_reference0)) //compare Data {passed++; std::cout << " => Test passed!!!\n";} testnum++; ////////////////////////////////////////////////////////////////////////////////////////////////// /*////////////*/ name = "test_branch_loop_hard"; // Branch 2 ///////////////// setZero(h_data0,&h_data_reference0); h_data0->i = h_data_reference0.i = 7; h_data0->u = h_data_reference0.u = 10; std::cout << "=============== Test " << testnum << ": " << name << " ===================\n"; loadAndRunTestFunction(&hModule, name, d_data0, h_data0, memSize); //run device function test_branch_loop_hard(&h_data_reference0); //run host reference if(compareData(h_data0,&h_data_reference0)) //compare Data {passed++; std::cout << " => Test passed!!!\n";} testnum++; ////////////////////////////////////////////////////////////////////////////////////////////////// /*///////////////*/ name = "test_binaryInst"; ///////////////////////// setZero(h_data0,&h_data_reference0); h_data0->i = h_data_reference0.i = 5; h_data0->f = h_data_reference0.f = -121.23; std::cout << "=============== Test " << testnum << ": " << name << " ===================\n"; loadAndRunTestFunction(&hModule, name, d_data0, h_data0, memSize); //run device function test_binaryInst(&h_data_reference0); //run host reference if(compareData(h_data0,&h_data_reference0)) //compare Data {passed++; std::cout << " => Test passed!!!\n";} testnum++; ////////////////////////////////////////////////////////////////////////////////////////////////// /*///////////////*/ name = "test_selp"; ///////////////////////// setZero(h_data0,&h_data_reference0); h_data0->i = h_data_reference0.i = -15; std::cout << "=============== Test " << testnum << ": " << name << " ===================\n"; loadAndRunTestFunction(&hModule, name, d_data0, h_data0, memSize); //run device function test_selp(&h_data_reference0); //run host reference if(compareData(h_data0,&h_data_reference0)) //compare Data {passed++; std::cout << " => Test passed!!!\n";} testnum++; ////////////////////////////////////////////////////////////////////////////////////////////////// /*///////////////*/ name = "test_GetElementPointer_complicated"; ///////////////////////// setZero(h_data0,&h_data_reference0); h_data0->i = h_data_reference0.i = 1; h_data_reference0.s.s.f = h_data0->s.s.f = 3.11; h_data_reference0.s.sa[2].f = h_data0->s.sa[2].f = -4.32; h_data_reference0.s.sa[h_data0->i].f = h_data0->s.sa[h_data0->i].f = 111.3; std::cout << "=============== Test " << testnum << ": " << name << " ===================\n"; loadAndRunTestFunction(&hModule, name, d_data0, h_data0, memSize); //run device function test_GetElementPointer_complicated(&h_data_reference0); //run host reference if(compareData(h_data0,&h_data_reference0)) //compare Data {passed++; std::cout << " => Test passed!!!\n";} testnum++; ////////////////////////////////////////////////////////////////////////////////////////////////// /*///////////////*/ name = "test_call"; ///////////////////////// setZero(h_data0,&h_data_reference0); h_data0->i = h_data_reference0.i = 10; std::cout << "=============== Test " << testnum << ": " << name << " ===================\n"; loadAndRunTestFunction(&hModule, name, d_data0, h_data0, memSize); //run device function test_call(&h_data_reference0); //run host reference if(compareData(h_data0,&h_data_reference0)) //compare Data {passed++; std::cout << " => Test passed!!!\n";} testnum++; ////////////////////////////////////////////////////////////////////////////////////////////////// /*/////////////*/ name = "test_alloca"; ///////////////////////// setZero(h_data0,&h_data_reference0); h_data0->i = h_data_reference0.i = 1; h_data0->f = h_data_reference0.f = -3.23; std::cout << "=============== Test " << testnum << ": " << name << " ===================\n"; loadAndRunTestFunction(&hModule, name, d_data0, h_data0, memSize); //run device function test_alloca(&h_data_reference0); //run host reference if(compareData(h_data0,&h_data_reference0)) //compare Data {passed++; std::cout << " => Test passed!!!\n";} testnum++; ////////////////////////////////////////////////////////////////////////////////////////////////// /*///////////////*/ name = "test_alloca_complicated"; ///////////////////////// setZero(h_data0,&h_data_reference0); h_data0->i = h_data_reference0.i = 1; h_data0->f = h_data_reference0.f = 23.213; std::cout << "=============== Test " << testnum << ": " << name << " ===================\n"; loadAndRunTestFunction(&hModule, name, d_data0, h_data0, memSize); //run device function test_alloca_complicated(&h_data_reference0); //run host reference if(compareData(h_data0,&h_data_reference0)) //compare Data {passed++; std::cout << " => Test passed!!!\n";} testnum++; ////////////////////////////////////////////////////////////////////////////////////////////////// /*///////////////*/ name = "test_globalVariables"; ///////////////////////// setZero(h_data0,&h_data_reference0); std::cout << "=============== Test " << testnum << ": " << name << " ===================\n"; loadAndRunTestFunction(&hModule, name, d_data0, h_data0, memSize); //run device function test_globalVariables(&h_data_reference0); //run host reference if(compareData(h_data0,&h_data_reference0)) //compare Data {passed++; std::cout << " => Test passed!!!\n";} testnum++; ////////////////////////////////////////////////////////////////////////////////////////////////// /*///////////////*/ name = "test_specialRegisters_x"; ///////////////////////// setZero(h_data0,&h_data_reference0); std::cout << "=============== Test " << testnum << ": " << name << " ===================\n"; loadAndRunTestFunction(&hModule, name, d_data0, h_data0, memSize, 2,3,4, 2,3); //run device function runHostTestFunction(test_specialRegisters_x, &h_data_reference0, 2,3,4, 2,3); //run host reference if(compareData(h_data0,&h_data_reference0)) //compare Data {passed++; std::cout << " => Test passed!!!\n";} testnum++; ////////////////////////////////////////////////////////////////////////////////////////////////// /*///////////////*/ name = "test_specialRegisters_y"; ///////////////////////// setZero(h_data0,&h_data_reference0); std::cout << "=============== Test " << testnum << ": " << name << " ===================\n"; loadAndRunTestFunction(&hModule, name, d_data0, h_data0, memSize, 2,3,4, 2,3); //run device function runHostTestFunction(test_specialRegisters_x, &h_data_reference0, 2,3,4, 2,3); //run host reference if(compareData(h_data0,&h_data_reference0)) //compare Data {passed++; std::cout << " => Test passed!!!\n";} testnum++; ////////////////////////////////////////////////////////////////////////////////////////////////// /*///////////////*/ name = "test_dualArgument"; ///////////////////////// setZero(h_data0,&h_data_reference0); setZero(h_data1,&h_data_reference1); std::cout << "=============== Test " << testnum << ": " << name << " ===================\n"; loadAndRunDualTestFunction(&hModule, name, d_data0, d_data1, h_data0, h_data1, memSize); //run device function test_dualArgument(&h_data_reference0,&h_data_reference1); //run host reference if(compareData(h_data0,&h_data_reference0)) //compare Data {passed++; std::cout << " => Test passed!!!\n";} if(compareData(h_data1,&h_data_reference1)) //compare Data {passed++; std::cout << " => Test passed!!!\n";} testnum++; testnum++; ////////////////////////////////////////////////////////////////////////////////////////////////// /*///////////////*/ name = "test_vector"; ///////////////////////// setZero(h_data0,&h_data_reference0); h_data0->fa[0] = h_data_reference0.fa[0] = 0.43f; h_data0->fa[1] = h_data_reference0.fa[1] = 0.234f; h_data0->fa[2] = h_data_reference0.fa[2] = 12893.f; h_data0->fa[3] = h_data_reference0.fa[3] = 13.33f; std::cout << "=============== Test " << testnum << ": " << name << " ===================\n"; loadAndRunTestFunction(&hModule, name, d_data0, h_data0, memSize); //run device function test_vector(&h_data_reference0); //run host reference if(compareData(h_data0,&h_data_reference0)) //compare Data {passed++; std::cout << " => Test passed!!!\n";} testnum++; ////////////////////////////////////////////////////////////////////////////////////////////////// /*///////////////*/ name = "test_reg2Const"; ///////////////////////// setZero(h_data0,&h_data_reference0); /* unsigned int bytes; //size of constant CUdeviceptr devptr_const=0; status = cuModuleGetGlobal(&devptr_const, &bytes, hModule, "__ptx_constant_data_global"); cuMemcpyHtoD(devptr_const, h_data0, memSize); */ std::cout << "=============== Test " << testnum << ": " << name << " ===================\n"; loadAndRunTestFunction(&hModule, name, d_data0, h_data0, memSize); //run device function test_reg2Const(&h_data_reference0); //run host reference if(compareData(h_data0,&h_data_reference0)) //compare Data {passed++; std::cout << " => Test passed!!!\n";} testnum++; ////////////////////////////////////////////////////////////////////////////////////////////////// /*///////////////*/ name = "test_constantMemory"; ///////////////////////// setZero(h_data0,&h_data_reference0); h_data0->fa[0] = __ptx_constant_data_global.fa[0] = 0.2348f; unsigned int bytes; //size of constant CUdeviceptr devptr_const=0; status = cuModuleGetGlobal(&devptr_const, &bytes, hModule, "__ptx_constant_data_global"); cuMemcpyHtoD(devptr_const, h_data0, memSize); setZero(h_data0,&h_data_reference0); std::cout << "=============== Test " << testnum << ": " << name << " ===================\n"; loadAndRunTestFunction(&hModule, name, d_data0, h_data0, memSize); //run device function test_constantMemory(&h_data_reference0); //run host reference if(compareData(h_data0,&h_data_reference0)) //compare Data {passed++; std::cout << " => Test passed!!!\n";} testnum++; ////////////////////////////////////////////////////////////////////////////////////////////////// /*///////////////*/ name = "test_sharedMemory"; ///////////////////////// setZero(h_data0,&h_data_reference0); for(int i = 0; i < ARRAY_N/2; i++) h_data0->fa[i*2] = i; for(int i = 0; i < ARRAY_N/2; i++) h_data0->fa[i*2+1] = -i; std::cout << "=============== Test " << testnum << ": " << name << " ===================\n"; loadAndRunTestFunction(&hModule, name, d_data0, h_data0, memSize, 32,1,1, 1,1); //run device function for(int i = 0; i < ARRAY_N/2; i++) h_data_reference0.fa[i] = i; for(int i = 0; i < ARRAY_N/2; i++) h_data_reference0.fa[i+32] = -i; // runHostTestFunction(test_sharedMemory, &h_data_reference0, 16,1,1, 1,1); //run host reference if(compareData(h_data0,&h_data_reference0)) //compare Data {passed++; std::cout << " => Test passed!!!\n";} testnum++; ////////////////////////////////////////////////////////////////////////////////////////////////// /*///////////////*/ name = "test_lightShader"; ///////////////////////// setZero(h_data0,&h_data_reference0); /* unsigned int bytes; //size of constant CUdeviceptr devptr_const=0; status = cuModuleGetGlobal(&devptr_const, &bytes, hModule, "__ptx_constant_data_global"); cuMemcpyHtoD(devptr_const, h_data0, memSize); */ std::cout << "=============== Test " << testnum << ": " << name << " ===================\n"; loadAndRunTestFunction(&hModule, name, d_data0, h_data0, memSize); //run device function /* test_lightShader(&h_data_reference0); //run host reference if(compareData(h_data0,&h_data_reference0)) //compare Data {passed++; std::cout << " => Test passed!!!\n";} testnum++; */ /////////////////////////////////////////////////////////////////////////////// //======================= test cases END ====================================// /////////////////////////////////////////////////////////////////////////////// // Check the result std::cout << "\nPASSED " << passed << " tests" << std::endl; std::cout << "FAILED " << (testnum-passed) << " tests" << std::endl; // Cleanup if (d_data0) { cuMemFree(d_data0); d_data0 = 0; } if (d_data1) { cuMemFree(d_data1); d_data1 = 0; } if (h_data0) { free(h_data0); h_data0 = 0; } if (h_data1) { free(h_data1); h_data1 = 0; } if (hModule) { cuModuleUnload(hModule); hModule = 0; } if (hStream) { cuStreamDestroy(hStream); hStream = 0; } if (hContext) { cuCtxDestroy(hContext); hContext = 0; } return 0; }
void test_routines () { extern void test_math (); test_math (); }