From 67df7873612cf7755d294a6fa8c8046da9905bdc Mon Sep 17 00:00:00 2001 From: Incardona Pietro <incardon@mpi-cbg.de> Date: Sun, 14 Mar 2021 17:07:37 +0100 Subject: [PATCH] Fixin Example to work on CPU --- example/Vector/7_SPH_dlb_gpu_opt/Makefile | 6 ++++-- example/Vector/7_SPH_dlb_gpu_opt/main.cu | 7 +++---- install | 2 +- openfpm_pdata.doc | 2 +- 4 files changed, 9 insertions(+), 8 deletions(-) diff --git a/example/Vector/7_SPH_dlb_gpu_opt/Makefile b/example/Vector/7_SPH_dlb_gpu_opt/Makefile index 24d51560f..e259e9161 100644 --- a/example/Vector/7_SPH_dlb_gpu_opt/Makefile +++ b/example/Vector/7_SPH_dlb_gpu_opt/Makefile @@ -9,6 +9,7 @@ ifdef CUDA_ON_CPU INCLUDE_PATH_NVCC= CUDA_CC_LINK=mpic++ CUDA_OPTIONS=-DCUDA_ON_CPU -D__NVCC__ -DCUDART_VERSION=11000 + LIBS_SELECT=$(LIBS_CUDA_ON_CPU) else ifeq (, $(shell which nvcc)) CUDA_CC=mpic++ -x c++ $(INCLUDE_PATH) @@ -20,6 +21,7 @@ else CUDA_CC_LINK=nvcc -ccbin=mpic++ CUDA_OPTIONS=-use_fast_math -arch=sm_61 -lineinfo endif + LIBS_SELECT=$(LIBS) endif @@ -47,10 +49,10 @@ sph_dlb_test: sph_dlb $(CC) -O3 $(OPT) -g -c --std=c++14 -o $@ $< $(INCLUDE_PATH) sph_dlb: $(OBJ) - $(CUDA_CC_LINK) -o $@ $^ $(CFLAGS) $(LIBS_PATH) $(LIBS) + $(CUDA_CC_LINK) -o $@ $^ $(CFLAGS) $(LIBS_PATH) $(LIBS_SELECT) sph_dlb2: $(OBJ) - $(CUDA_CC_LINK) -o $@ $^ $(CFLAGS) $(LIBS_PATH) $(LIBS) + $(CUDA_CC_LINK) -o $@ $^ $(CFLAGS) $(LIBS_PATH) $(LIBS_SELECT) all: sph_dlb diff --git a/example/Vector/7_SPH_dlb_gpu_opt/main.cu b/example/Vector/7_SPH_dlb_gpu_opt/main.cu index 140ca52b6..149102396 100644 --- a/example/Vector/7_SPH_dlb_gpu_opt/main.cu +++ b/example/Vector/7_SPH_dlb_gpu_opt/main.cu @@ -870,8 +870,7 @@ int main(int argc, char* argv[]) // Ok the initialization is done on CPU on GPU we are doing the main loop, so first we offload all properties on GPU vd.hostToDevicePos(); - vd.template hostToDeviceProp<type,rho,rho_prev,Pressure,velocity>(); - + vd.template hostToDeviceProp<type,rho,rho_prev,Pressure,velocity,velocity_prev>(); vd.ghost_get<type,rho,Pressure,velocity>(RUN_ON_DEVICE); @@ -890,7 +889,6 @@ int main(int argc, char* argv[]) Vcluster<> & v_cl = create_vcluster(); timer it_time; - ////// Do rebalancing every 200 timesteps it_reb++; if (it_reb == 300) @@ -923,10 +921,10 @@ int main(int argc, char* argv[]) vd.ghost_get<type,rho,Pressure,velocity>(RUN_ON_DEVICE); - // Calc forces calc_forces(vd,NN,max_visc,cnt); + // Get the maximum viscosity term across processors v_cl.max(max_visc); v_cl.execute(); @@ -999,6 +997,7 @@ int main(int argc, char* argv[]) if (v_cl.getProcessUnitID() == 0) {std::cout << "TIME: " << t << " " << it_time.getwct() << " " << it_reb << " " << cnt << " Max visc: " << max_visc << " " << vd.size_local() << std::endl;} } + } tot_sim.stop(); diff --git a/install b/install index 1fead2720..9c7603891 100755 --- a/install +++ b/install @@ -433,7 +433,7 @@ if [ x"$cuda_on_cpu" == x"YES" ]; then fi if [ x"$gpu_support" == x"1" ]; then echo "LIBS=-lvcluster -lofpm_pdata -lofpmmemory -lparmetis -lmetis -lboost_iostreams -lboost_program_options -lhdf5 -llibhilbert -lVc $(cat cuda_lib) $lin_alg_lib -ldl -lboost_filesystem -lboost_system" >> example.mk - echo "LIBS_CUDA_ON_CPU=-lvcluster_cuda_on_cpu -lofpmmemory_cuda_on_cpu -lparmetis -lmetis -lboost_iostreams -lboost_program_options -lhdf5 -llibhilbert -lVc $(cat cuda_lib) $lin_alg_lib -lboost_filesystem -lboost_system" >> example.mk + echo "LIBS_CUDA_ON_CPU=-lvcluster_cuda_on_cpu -lofpmmemory_cuda_on_cpu -lparmetis -lmetis -lboost_iostreams -lboost_program_options -lhdf5 -llibhilbert -lVc $(cat cuda_lib) $lin_alg_lib -lboost_filesystem -lboost_system -lboost_context" >> example.mk else echo "LIBS=-lvcluster -lofpm_pdata -lofpmmemory -lparmetis -lmetis -lboost_iostreams -lboost_program_options -lhdf5 -llibhilbert -lVc $lin_alg_lib -ldl -lboost_filesystem -lboost_system $optional_boost" >> example.mk fi diff --git a/openfpm_pdata.doc b/openfpm_pdata.doc index 1ecffa9cc..6b92e4f98 100644 --- a/openfpm_pdata.doc +++ b/openfpm_pdata.doc @@ -38,7 +38,7 @@ PROJECT_NAME = "OpenFPM_pdata" # could be handy for archiving the generated documentation or if some version # control system is used. -PROJECT_NUMBER = 3.1.0 +PROJECT_NUMBER = 3.2.0 # Using the PROJECT_BRIEF tag one can provide an optional one line description # for a project that appears at the top of each page and should give viewer a -- GitLab