|
QUDA v0.3.2
A library for QCD on GPUs
|
00001 #include <stdio.h> 00002 #include <stdlib.h> 00003 #include <string.h> 00004 00005 #include <quda.h> 00006 #include <test_util.h> 00007 #include <gauge_quda.h> 00008 #include "misc.h" 00009 #include "gauge_force_reference.h" 00010 #include "gauge_force_quda.h" 00011 #include <sys/time.h> 00012 00013 typedef struct { 00014 double real; 00015 double imag; 00016 } dcomplex; 00017 00018 typedef struct { dcomplex e[3][3]; } dsu3_matrix; 00019 00020 extern void initDslashCuda(FullGauge gauge); 00021 00022 int device = 0; 00023 00024 FullGauge cudaSiteLink; 00025 FullMom cudaMom; 00026 QudaGaugeParam gaugeParam; 00027 void* siteLink; 00028 void* mom; 00029 void* refMom; 00030 00031 int verify_results = 0; 00032 int ODD_BIT = 1; 00033 int sdim= 8; 00034 int tdim = 8; 00035 00036 int Z[4]; 00037 int V; 00038 int Vh; 00039 00040 QudaReconstructType link_recon = QUDA_RECONSTRUCT_12; 00041 QudaPrecision link_prec = QUDA_SINGLE_PRECISION; 00042 00043 void 00044 setDims(int *X) { 00045 V = 1; 00046 for (int d=0; d< 4; d++) { 00047 V *= X[d]; 00048 Z[d] = X[d]; 00049 } 00050 Vh = V/2; 00051 } 00052 00053 00054 static void 00055 gauge_force_init() 00056 { 00057 initQuda(device); 00058 //cudaSetDevice(dev); CUERR; 00059 00060 gaugeParam.X[0] = sdim; 00061 gaugeParam.X[1] = sdim; 00062 gaugeParam.X[2] = sdim; 00063 gaugeParam.X[3] = tdim; 00064 00065 setDims(gaugeParam.X); 00066 00067 gaugeParam.cpu_prec = QUDA_SINGLE_PRECISION; 00068 gaugeParam.cuda_prec = link_prec; 00069 00070 size_t gSize = (gaugeParam.cpu_prec == QUDA_DOUBLE_PRECISION) ? sizeof(double) : sizeof(float); 00071 00072 siteLink = malloc(4*V*gaugeSiteSize* gSize); 00073 if (siteLink == NULL){ 00074 fprintf(stderr, "ERROR: malloc failed for sitelink\n"); 00075 exit(1); 00076 } 00077 00078 00079 mom = malloc(4*V*momSiteSize*gSize); 00080 if (mom == NULL){ 00081 fprintf(stderr, "ERROR: malloc failed for mom\n"); 00082 exit(1); 00083 } 00084 00085 createSiteLinkCPU(siteLink, gaugeParam.cpu_prec, 0); 00086 00087 #if 0 00088 site_link_sanity_check(siteLink, V, gaugeParam.cpu_prec, &gaugeParam); 00089 #endif 00090 00091 createMomCPU(mom, gaugeParam.cpu_prec); 00092 memset(mom, 0, 4*V*momSiteSize*gSize); 00093 00094 refMom = malloc(4*V*momSiteSize*gSize); 00095 if (refMom == NULL){ 00096 fprintf(stderr, "ERROR: malloc failed for refMom\n"); 00097 exit(1); 00098 } 00099 00100 memcpy(refMom, mom, 4*V*momSiteSize*gSize); 00101 00102 gaugeParam.reconstruct = link_recon; 00103 createLinkQuda(&cudaSiteLink, &gaugeParam); 00104 00105 createMomQuda(&cudaMom, &gaugeParam); 00106 00107 00108 00109 return; 00110 } 00111 00112 static void 00113 gauge_force_end() 00114 { 00115 free(siteLink); 00116 free(mom); 00117 00118 freeLinkQuda(&cudaSiteLink); 00119 freeMomQuda(&cudaMom); 00120 } 00121 00122 00123 static void 00124 gauge_force_test(void) 00125 { 00126 int path_dir_x[][5] = { 00127 {1, 7, 6 }, 00128 {6, 7, 1 }, 00129 {2, 7, 5 }, 00130 {5, 7, 2 }, 00131 {3, 7, 4 }, 00132 {4, 7, 3 }, 00133 {0, 1, 7, 7, 6 }, 00134 {1, 7, 7, 6, 0 }, 00135 {6, 7, 7, 1, 0 }, 00136 {0, 6, 7, 7, 1 }, 00137 {0, 2, 7, 7, 5 }, 00138 {2, 7, 7, 5, 0 }, 00139 {5, 7, 7, 2, 0 }, 00140 {0, 5, 7, 7, 2 }, 00141 {0, 3, 7, 7, 4 }, 00142 {3, 7, 7, 4, 0 }, 00143 {4, 7, 7, 3, 0 }, 00144 {0, 4, 7, 7, 3 }, 00145 {6, 6, 7, 1, 1 }, 00146 {1, 1, 7, 6, 6 }, 00147 {5, 5, 7, 2, 2 }, 00148 {2, 2, 7, 5, 5 }, 00149 {4, 4, 7, 3, 3 }, 00150 {3, 3, 7, 4, 4 }, 00151 {1, 2, 7, 6, 5 }, 00152 {5, 6, 7, 2, 1 }, 00153 {1, 5, 7, 6, 2 }, 00154 {2, 6, 7, 5, 1 }, 00155 {6, 2, 7, 1, 5 }, 00156 {5, 1, 7, 2, 6 }, 00157 {6, 5, 7, 1, 2 }, 00158 {2, 1, 7, 5, 6 }, 00159 {1, 3, 7, 6, 4 }, 00160 {4, 6, 7, 3, 1 }, 00161 {1, 4, 7, 6, 3 }, 00162 {3, 6, 7, 4, 1 }, 00163 {6, 3, 7, 1, 4 }, 00164 {4, 1, 7, 3, 6 }, 00165 {6, 4, 7, 1, 3 }, 00166 {3, 1, 7, 4, 6 }, 00167 {2, 3, 7, 5, 4 }, 00168 {4, 5, 7, 3, 2 }, 00169 {2, 4, 7, 5, 3 }, 00170 {3, 5, 7, 4, 2 }, 00171 {5, 3, 7, 2, 4 }, 00172 {4, 2, 7, 3, 5 }, 00173 {5, 4, 7, 2, 3 }, 00174 {3, 2, 7, 4, 5 }, 00175 }; 00176 00177 00178 int length[]={ 00179 3, 00180 3, 00181 3, 00182 3, 00183 3, 00184 3, 00185 5, 00186 5, 00187 5, 00188 5, 00189 5, 00190 5, 00191 5, 00192 5, 00193 5, 00194 5, 00195 5, 00196 5, 00197 5, 00198 5, 00199 5, 00200 5, 00201 5, 00202 5, 00203 5, 00204 5, 00205 5, 00206 5, 00207 5, 00208 5, 00209 5, 00210 5, 00211 5, 00212 5, 00213 5, 00214 5, 00215 5, 00216 5, 00217 5, 00218 5, 00219 5, 00220 5, 00221 5, 00222 5, 00223 5, 00224 5, 00225 5, 00226 5, 00227 }; 00228 00229 float loop_coeff[]={ 00230 1.1, 00231 1.2, 00232 1.3, 00233 1.4, 00234 1.5, 00235 1.6, 00236 2.5, 00237 2.6, 00238 2.7, 00239 2.8, 00240 2.9, 00241 3.0, 00242 3.1, 00243 3.2, 00244 3.3, 00245 3.4, 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, 00398 { 2 ,4 ,4 ,5 ,3 }, 00399 { 5 ,4 ,4 ,2 ,3 }, 00400 { 3 ,5 ,4 ,4 ,2 }, 00401 { 7 ,7 ,4 ,0 ,0 }, 00402 { 0 ,0 ,4 ,7 ,7 }, 00403 { 6 ,6 ,4 ,1 ,1 }, 00404 { 1 ,1 ,4 ,6 ,6 }, 00405 { 5 ,5 ,4 ,2 ,2 }, 00406 { 2 ,2 ,4 ,5 ,5 }, 00407 { 0 ,1 ,4 ,7 ,6 }, 00408 { 6 ,7 ,4 ,1 ,0 }, 00409 { 0 ,6 ,4 ,7 ,1 }, 00410 { 1 ,7 ,4 ,6 ,0 }, 00411 { 7 ,1 ,4 ,0 ,6 }, 00412 { 6 ,0 ,4 ,1 ,7 }, 00413 { 7 ,6 ,4 ,0 ,1 }, 00414 { 1 ,0 ,4 ,6 ,7 }, 00415 { 0 ,2 ,4 ,7 ,5 }, 00416 { 5 ,7 ,4 ,2 ,0 }, 00417 { 0 ,5 ,4 ,7 ,2 }, 00418 { 2 ,7 ,4 ,5 ,0 }, 00419 { 7 ,2 ,4 ,0 ,5 }, 00420 { 5 ,0 ,4 ,2 ,7 }, 00421 { 7 ,5 ,4 ,0 ,2 }, 00422 { 2 ,0 ,4 ,5 ,7 }, 00423 { 1 ,2 ,4 ,6 ,5 }, 00424 { 5 ,6 ,4 ,2 ,1 }, 00425 { 1 ,5 ,4 ,6 ,2 }, 00426 { 2 ,6 ,4 ,5 ,1 }, 00427 { 6 ,2 ,4 ,1 ,5 }, 00428 { 5 ,1 ,4 ,2 ,6 }, 00429 { 6 ,5 ,4 ,1 ,2 }, 00430 { 2 ,1 ,4 ,5 ,6 } 00431 }; 00432 00433 int max_length = 6; 00434 00435 00436 gauge_force_init(); 00437 00438 initDslashConstants(cudaSiteLink, 0,0); 00439 gauge_force_init_cuda(&gaugeParam, max_length); 00440 00441 double eb3 = 0.3; 00442 int num_paths = sizeof(path_dir_x)/sizeof(path_dir_x[0]); 00443 00444 int i; 00445 00446 int** input_path; 00447 input_path = (int**)malloc(num_paths*sizeof(int*)); 00448 if (input_path == NULL){ 00449 printf("ERORR: malloc failed for input path\n"); 00450 exit(1); 00451 } 00452 for(i=0;i < num_paths;i++){ 00453 input_path[i] = (int*)malloc(length[i]*sizeof(int)); 00454 if (input_path[i] == NULL){ 00455 printf("ERROR: malloc failed for input_path[%d]\n", i); 00456 exit(1); 00457 } 00458 } 00459 00460 loadMomToGPU(cudaMom, mom, &gaugeParam); 00461 loadLinkToGPU(cudaSiteLink, siteLink, &gaugeParam); 00462 00463 #define CX 1 00464 #define CY 1 00465 #define CZ 1 00466 #define CT 1 00467 00468 if (verify_results){ 00469 00470 #ifdef CX 00471 for(i=0;i < num_paths;i++){ 00472 memcpy(input_path[i], path_dir_x, length[i]*sizeof(int)); 00473 } 00474 gauge_force_reference(refMom, 0, eb3, siteLink, gaugeParam.cpu_prec, input_path, length, loop_coeff, num_paths); 00475 #endif 00476 00477 #ifdef CY 00478 for(i=0;i < num_paths;i++){ 00479 memcpy(input_path[i], path_dir_y, length[i]*sizeof(int)); 00480 } 00481 gauge_force_reference(refMom, 1, eb3, siteLink, gaugeParam.cpu_prec, input_path, length, loop_coeff, num_paths); 00482 #endif 00483 00484 #ifdef CZ 00485 for(i=0;i < num_paths;i++){ 00486 memcpy(input_path[i], path_dir_z, length[i]*sizeof(int)); 00487 } 00488 gauge_force_reference(refMom, 2, eb3, siteLink, gaugeParam.cpu_prec, input_path, length, loop_coeff, num_paths); 00489 #endif 00490 00491 #ifdef CT 00492 for(i=0;i < num_paths;i++){ 00493 memcpy(input_path[i], path_dir_t, length[i]*sizeof(int)); 00494 } 00495 gauge_force_reference(refMom, 3, eb3, siteLink, gaugeParam.cpu_prec, input_path, length, loop_coeff, num_paths); 00496 #endif 00497 00498 } 00499 00500 00501 //The number comes from CPU implementation in MILC, gauge_force_imp.c 00502 int flops=153004; 00503 00504 00505 00506 struct timeval t0, t1; 00507 gettimeofday(&t0, NULL); 00508 00509 #ifdef CX 00510 for(i=0;i < num_paths;i++){ 00511 memcpy(input_path[i], path_dir_x, length[i]*sizeof(int)); 00512 } 00513 gauge_force_cuda(cudaMom, 0, eb3, cudaSiteLink, &gaugeParam, input_path, length, loop_coeff, num_paths, max_length); 00514 #endif 00515 00516 #ifdef CY 00517 for(i=0;i < num_paths;i++){ 00518 memcpy(input_path[i], path_dir_y, length[i]*sizeof(int)); 00519 } 00520 gauge_force_cuda(cudaMom, 1, eb3, cudaSiteLink, &gaugeParam, input_path, length, loop_coeff, num_paths, max_length); 00521 #endif 00522 00523 #ifdef CZ 00524 for(i=0;i < num_paths;i++){ 00525 memcpy(input_path[i], path_dir_z, length[i]*sizeof(int)); 00526 } 00527 gauge_force_cuda(cudaMom, 2, eb3, cudaSiteLink, &gaugeParam, input_path, length, loop_coeff, num_paths, max_length); 00528 #endif 00529 00530 #ifdef CT 00531 for(i=0;i < num_paths;i++){ 00532 memcpy(input_path[i], path_dir_t, length[i]*sizeof(int)); 00533 } 00534 gauge_force_cuda(cudaMom, 3, eb3, cudaSiteLink, &gaugeParam, input_path, length, loop_coeff, num_paths, max_length); 00535 #endif 00536 00537 00538 gettimeofday(&t1, NULL); 00539 double secs = t1.tv_sec - t0.tv_sec + 0.000001*(t1.tv_usec - t0.tv_usec); 00540 00541 storeMomToCPU(mom, cudaMom, &gaugeParam); 00542 00543 int res; 00544 res = compare_floats(mom, refMom, 4*V*momSiteSize, 1e-3, gaugeParam.cpu_prec); 00545 00546 strong_check_mom(mom, refMom, 4*V, gaugeParam.cpu_prec); 00547 00548 printf("Test %s\n",(1 == res) ? "PASSED" : "FAILED"); 00549 00550 int volume = gaugeParam.X[0]*gaugeParam.X[1]*gaugeParam.X[2]*gaugeParam.X[3]; 00551 double perf = 1.0* flops*volume/(secs*1024*1024*1024); 00552 printf("gpu time =%.2f ms, flops= %.2f Gflops\n", secs*1000, perf); 00553 00554 gauge_force_end(); 00555 00556 if (res == 0){//failed 00557 printf("\n"); 00558 printf("Warning: you test failed. \n"); 00559 printf(" Did you use --verify?\n"); 00560 printf(" Did you check the GPU health by running cuda memtest?\n"); 00561 } 00562 00563 00564 } 00565 00566 00567 static void 00568 display_test_info() 00569 { 00570 printf("running the following test:\n"); 00571 00572 printf("link_precision link_reconstruct S_dimension T_dimension\n"); 00573 printf("%s %s %d %d\n", 00574 get_prec_str(link_prec), 00575 get_recon_str(link_recon), 00576 sdim, tdim); 00577 return ; 00578 00579 } 00580 00581 static void 00582 usage(char** argv ) 00583 { 00584 printf("Usage: %s <args>\n", argv[0]); 00585 printf(" --device <dev_id> Set which device to run on\n"); 00586 printf(" --gprec <double/single/half> Link precision\n"); 00587 printf(" --recon <8/12> Link reconstruction type\n"); 00588 printf(" --sdim <n> Set spacial dimention\n"); 00589 printf(" --tdim Set T dimention size(default 24)\n"); 00590 printf(" --verify Verify the GPU results using CPU results\n"); 00591 printf(" --help Print out this message\n"); 00592 exit(1); 00593 return ; 00594 } 00595 00596 int 00597 main(int argc, char **argv) 00598 { 00599 int i; 00600 for (i =1;i < argc; i++){ 00601 00602 if( strcmp(argv[i], "--help")== 0){ 00603 usage(argv); 00604 } 00605 00606 if( strcmp(argv[i], "--gprec") == 0){ 00607 if (i+1 >= argc){ 00608 usage(argv); 00609 } 00610 link_prec = get_prec(argv[i+1]); 00611 i++; 00612 continue; 00613 } 00614 00615 if( strcmp(argv[i], "--recon") == 0){ 00616 if (i+1 >= argc){ 00617 usage(argv); 00618 } 00619 link_recon = get_recon(argv[i+1]); 00620 i++; 00621 continue; 00622 } 00623 00624 if( strcmp(argv[i], "--tdim") == 0){ 00625 if (i+1 >= argc){ 00626 usage(argv); 00627 } 00628 tdim = atoi(argv[i+1]); 00629 if (tdim < 0 || tdim > 128){ 00630 fprintf(stderr, "Error: invalid t dimention\n"); 00631 exit(1); 00632 } 00633 i++; 00634 continue; 00635 } 00636 if( strcmp(argv[i], "--sdim") == 0){ 00637 if (i+1 >= argc){ 00638 usage(argv); 00639 } 00640 sdim = atoi(argv[i+1]); 00641 if (sdim < 0 || sdim > 128){ 00642 fprintf(stderr, "Error: invalid space dimention\n"); 00643 exit(1); 00644 } 00645 i++; 00646 continue; 00647 } 00648 if( strcmp(argv[i], "--device") == 0){ 00649 if (i+1 >= argc){ 00650 usage(argv); 00651 } 00652 device = atoi(argv[i+1]); 00653 if (device < 0){ 00654 fprintf(stderr, "Error: invalid device number(%d)\n", device); 00655 exit(1); 00656 } 00657 i++; 00658 continue; 00659 } 00660 00661 if( strcmp(argv[i], "--verify") == 0){ 00662 verify_results=1; 00663 continue; 00664 } 00665 fprintf(stderr, "ERROR: Invalid option:%s\n", argv[i]); 00666 usage(argv); 00667 } 00668 00669 display_test_info(); 00670 00671 gauge_force_test(); 00672 00673 00674 return 0; 00675 }
1.7.3