@@ -2019,9 +2019,9 @@ int cogen_raytrace(struct instr_def *instr)
20192019 cout(" // If OPENACC/TOF_TRAIN we need to nuke internal arrays!");
20202020 cout(" #ifdef OPENACC");
20212021 cout(" #ifdef TOF_TRAIN");
2022- cout(" if (t_offset) free(t_offset);");
2023- cout(" if (p_trains) free(p_trains);");
2024- cout(" if (alive_trains) free(alive_trains);");
2022+ cout(" // if (t_offset) free(t_offset);");
2023+ cout(" // if (p_trains) free(p_trains);");
2024+ cout(" // if (alive_trains) free(alive_trains);");
20252025 cout(" #endif");
20262026 cout(" #endif");
20272027 cout("");
@@ -2439,15 +2439,20 @@ cogen_header(struct instr_def *instr, char *output_name)
24392439 cout("#endif");
24402440 cout("");
24412441
2442+ cout("#ifdef TOF_TRAIN");
24422443 cout("#ifndef OPENACC");
2443- cout("#ifdef TOF_TRAIN");
24442444 cout("int N_trains; /* initialised like e.g. ncount, seed from cmdline */");
24452445 cout("double *t_offset;");
24462446 cout("double *p_trains;");
24472447 cout("int *alive_trains;");
24482448 cout("double P_last_time_manipulation;");
2449+ cout("#else /* is OPENACC */");
2450+ cout("#ifndef NTOF_GPU");
2451+ cout("#define NTOF_GPU 100");
2452+ cout("#endif");
2453+ cout("#endif /* OPENACC */");
24492454 cout("#endif /* TOF_TRAIN */");
2450- cout("#endif /* NOT OPENACC */");
2455+
24512456 cout("");
24522457
24532458 /* the max number of user variables*/
@@ -2506,13 +2511,13 @@ cogen_header(struct instr_def *instr, char *output_name)
25062511 cout(" #ifdef OPENACC");
25072512 cout(" #ifdef TOF_TRAIN");
25082513 cout(" int N_trains; /* initialised like e.g. ncount, seed from cmdline */");
2509- cout(" double * t_offset;");
2510- cout(" double * p_trains;");
2511- cout(" int * alive_trains;");
2514+ cout(" double t_offset[NTOF_GPU] ;");
2515+ cout(" double p_trains[NTOF_GPU] ;");
2516+ cout(" int alive_trains[NTOF_GPU] ;");
25122517 cout(" double P_last_time_manipulation;");
2513- cout(" #pragma acc shape(t_offset[0:N_trains]) init_needed(N_trains)");
2514- cout(" #pragma acc shape(p_trains[0:N_trains]) init_needed(N_trains)");
2515- cout(" #pragma acc shape(alive_trains[0:N_trains]) init_needed(N_trains)");
2518+ cout(" // #pragma acc shape(t_offset[0:N_trains]) init_needed(N_trains)");
2519+ cout(" // #pragma acc shape(p_trains[0:N_trains]) init_needed(N_trains)");
2520+ cout(" // #pragma acc shape(alive_trains[0:N_trains]) init_needed(N_trains)");
25162521 cout(" int Ntof_init; /* 0/1 - set to 1 once \"times are filled in\" */");
25172522 cout(" #endif /* TOF_TRAIN */");
25182523 cout(" #endif /* OPENACC */");
0 commit comments