diff --git a/.gitignore b/.gitignore index 663bc00..578a7cc 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,6 @@ # Ignore all files in /output output/* +build/ # except for readOutput.m !readOutput.m diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..2e24098 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,46 @@ +##################################################### +cmake_minimum_required(VERSION 3.9 FATAL_ERROR) + +##################################################### +project(gPET LANGUAGES CXX CUDA) +#set(CMAKE_CUDA_STANDARD 14) +message("project source dir: ${PROJECT_SOURCE_DIR}") + +find_package(CUDA REQUIRED) +if (NOT CUDA_FOUND) + message(status "CUDA not found") +endif (NOT CUDA_FOUND) + +IF (WIN32) + message(STATUS "Now is windows") + #add_definitions(-Dwin32) +ELSE () + message(STATUS "Now is Linux") + #add_definitions(-DLinux) + #set(CMAKE_CXX_STANDARD 14) + #set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC") + #set(CMAKE_C_FLAGS "${CMAKE_CXX_FLAGS} -fPIC") + #set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++11") + #list(APPEND CMAKE_CXX_FLAGS " -std=c++0x ${CMAKE_CXX_FLAGS} -g -ftest-coverage -fprofile-arcs" ) +ENDIF() + + +#add include files +include_directories( +${PROJECT_SOURCE_DIR}/ +) + +message("CUDA_cublas_LIBRARY: ${CUDA_cublas_LIBRARY}") +message("CUDA_curand_LIBRARY: ${CUDA_curand_LIBRARY}") +#LINK_DIRECTORIES(${CUDA_CUBLAS_LIBRARIES}) + +SET(SRC_gPET ./detector.cu ./gPET.cu ./gPET_kernals.cu ./iniDevice.cu ./initialize.cu ./main.cu ) + + +#generate executable file +add_executable(gPET ${SRC_gPET} ) +#target_link_libraries(gPET PUBLIC ${CUDA_cublas_LIBRARY} ${CUDA_curand_LIBRARY} ) +set_target_properties(gPET PROPERTIES CUDA_ARCHITECTURES "35;50;72") +target_link_libraries(gPET PUBLIC cublas curand) +set_target_properties(gPET PROPERTIES CUDA_SEPARABLE_COMPILATION ON ) + diff --git a/constants.h b/constants.h old mode 100755 new mode 100644 diff --git a/cutil_math.h b/cutil_math.h old mode 100755 new mode 100644 diff --git a/data/input4gCTD.cmpsf b/data/input4gCTD.cmpsf old mode 100755 new mode 100644 diff --git a/data/input4gCTD.compt b/data/input4gCTD.compt old mode 100755 new mode 100644 diff --git a/data/input4gCTD.lamph b/data/input4gCTD.lamph old mode 100755 new mode 100644 diff --git a/data/input4gCTD.matter b/data/input4gCTD.matter old mode 100755 new mode 100644 diff --git a/data/input4gCTD.phote b/data/input4gCTD.phote old mode 100755 new mode 100644 diff --git a/data/input4gCTD.rayff b/data/input4gCTD.rayff old mode 100755 new mode 100644 diff --git a/data/input4gCTD.rayle b/data/input4gCTD.rayle old mode 100755 new mode 100644 diff --git a/data/input4gPET.cmpsf b/data/input4gPET.cmpsf old mode 100755 new mode 100644 diff --git a/data/input4gPET.compt b/data/input4gPET.compt old mode 100755 new mode 100644 diff --git a/data/input4gPET.lamph b/data/input4gPET.lamph old mode 100755 new mode 100644 diff --git a/data/input4gPET.matter b/data/input4gPET.matter old mode 100755 new mode 100644 diff --git a/data/input4gPET.phote b/data/input4gPET.phote old mode 100755 new mode 100644 diff --git a/data/input4gPET.rayff b/data/input4gPET.rayff old mode 100755 new mode 100644 diff --git a/data/input4gPET.rayle b/data/input4gPET.rayle old mode 100755 new mode 100644 diff --git a/data/isotopes.txt b/data/isotopes.txt old mode 100755 new mode 100644 diff --git a/detector.cu b/detector.cu old mode 100755 new mode 100644 index 79cbcdf..62b61ee --- a/detector.cu +++ b/detector.cu @@ -374,7 +374,7 @@ void orderevents(int* counts,Event* events_d) int start=0; for(int i=1; istart+1) quicksort(events,start,i,3); start=i; @@ -407,4 +407,4 @@ void outputData(void *src, const int size, const char *outputfilename, const cha free(tempData_h); } -#endif \ No newline at end of file +#endif diff --git a/detector.o b/detector.o deleted file mode 100755 index 781f7cd..0000000 Binary files a/detector.o and /dev/null differ diff --git a/externCUDA.h b/externCUDA.h old mode 100755 new mode 100644 diff --git a/gPET b/gPET deleted file mode 100755 index b642ad9..0000000 Binary files a/gPET and /dev/null differ diff --git a/gPET.cu b/gPET.cu old mode 100755 new mode 100644 diff --git a/gPET.h b/gPET.h old mode 100755 new mode 100644 diff --git a/gPET.o b/gPET.o deleted file mode 100755 index f93723f..0000000 Binary files a/gPET.o and /dev/null differ diff --git a/gPETInternal.h b/gPETInternal.h old mode 100755 new mode 100644 diff --git a/gPET_kernals.cu b/gPET_kernals.cu index 1b68fb6..b5f3510 100644 --- a/gPET_kernals.cu +++ b/gPET_kernals.cu @@ -748,6 +748,8 @@ int __device__ adder(int* counts_d, Event* events_d, Event event) return 1; } } + if(counts_d[0]>=counts_d[1]) + return 0; //no recorded event inside the the same crystal events_d[counts_d[0]]=event; counts_d[0]++; @@ -758,7 +760,11 @@ int __device__ readout(int* counts_d, Event* events_d,int depth, int policy) //this is for the readout part in digitizer //depth means the readout level. 0,1,2,3 represents world,panel,module,cry //policy 0,1 for winnertakeall and energy centroid - if(depth==3) return 1; + if(depth==3) + { + counts_d[1]=counts_d[0]; + return 1; + } if(policy==1) depth = 2; //the readout part switch(depth) diff --git a/gPET_kernals.h b/gPET_kernals.h old mode 100755 new mode 100644 diff --git a/iniDevice.cu b/iniDevice.cu old mode 100755 new mode 100644 diff --git a/iniDevice.o b/iniDevice.o deleted file mode 100755 index 2171cb5..0000000 Binary files a/iniDevice.o and /dev/null differ diff --git a/initialize.cu b/initialize.cu old mode 100755 new mode 100644 diff --git a/initialize.o b/initialize.o deleted file mode 100755 index 225bf0e..0000000 Binary files a/initialize.o and /dev/null differ diff --git a/input/config8.geo b/input/config8.geo old mode 100755 new mode 100644 diff --git a/input/cylinder_phantom_den.dat b/input/cylinder_phantom_den.dat old mode 100755 new mode 100644 diff --git a/input/cylinder_phantom_mat.dat b/input/cylinder_phantom_mat.dat old mode 100755 new mode 100644 diff --git a/input/pointsource.txt b/input/pointsource.txt old mode 100755 new mode 100644 diff --git a/input/psf.dat b/input/psf.dat old mode 100755 new mode 100644 diff --git a/input/source.txt b/input/source.txt old mode 100755 new mode 100644 diff --git a/input_PET.in b/input_PET.in old mode 100755 new mode 100644 diff --git a/kernal/gPET_kernals.o b/kernal/gPET_kernals.o deleted file mode 100755 index 06dce86..0000000 Binary files a/kernal/gPET_kernals.o and /dev/null differ diff --git a/main.cu b/main.cu old mode 100755 new mode 100644 diff --git a/main.o b/main.o deleted file mode 100755 index c0ca7ae..0000000 Binary files a/main.o and /dev/null differ