Commit af760dfa authored by incardon's avatar incardon

Fixing examples

parent e164dd64
Pipeline #2087 passed with stages
in 21 minutes and 46 seconds
......@@ -55,17 +55,18 @@ if(ENABLE_GPU)
find_package(CUDA)
if (CUDA_VERSION_MAJOR EQUAL 9 AND CUDA_VERSION_MINOR EQUAL 2)
message("CUDA is compatible")
message("CUDA is compatible 9.2")
set(WARNING_SUPPRESSION_AND_OPTION_NVCC -Xcudafe "--display_error_number --diag_suppress=611 --diag_suppress=2885 --diag_suppress=2886 --diag_suppress=2887 --diag_suppress=2888 --diag_suppress=186 --diag_suppress=111" --expt-extended-lambda)
FILE(WRITE cuda_options " -Xcudafe \"--display_error_number --diag_suppress=611 --diag_suppress=2885 --diag_suppress=2886 --diag_suppress=2887 --diag_suppress=2888 --diag_suppress=186 --diag_suppress=111\" --expt-extended-lambda ")
elseif ( CUDA_VERSION_MAJOR EQUAL 10 AND CUDA_VERSION_MINOR EQUAL 1 )
message("CUDA is compatible")
message("CUDA is compatible 10.1")
set(WARNING_SUPPRESSION_AND_OPTION_NVCC -Xcudafe "--display_error_number --diag_suppress=2915 --diag_suppress=2912 --diag_suppress=2913 --diag_suppress=111 --diag_suppress=186 --diag_suppress=611 " --expt-extended-lambda )
FILE(WRITE cuda_options "-Xcudafe \"--display_error_number --diag_suppress=2915 --diag_suppress=2914 --diag_suppress=2912 --diag_suppress=2913 --diag_suppress=111 --diag_suppress=186 --diag_suppress=611 \" --expt-extended-lambda")
elseif ( CUDA_VERSION_MAJOR EQUAL 10 AND CUDA_VERSION_MINOR EQUAL 2 )
message("CUDA is compatible")
message("CUDA is compatible 10.2")
set(WARNING_SUPPRESSION_AND_OPTION_NVCC -Xcudafe "--display_error_number --diag_suppress=2976 --diag_suppress=2977 --diag_suppress=2978 --diag_suppress=2979 --diag_suppress=1835 --diag_suppress=611 --diag_suppress=186 --diag_suppress=128" --expt-extended-lambda)
set(WARNING_SUPPRESSION_AND_OPTION_NVCC_TEXT "-Xcudafe \"--display_error_number --diag_suppress=2976 --diag_suppress=2977 --diag_suppress=2978 --diag_suppress=2979 --diag_suppress=1835 --diag_suppress=611 --diag_suppress=186 --diag_suppress=128\" --expt-extended-lambda")
FILE(WRITE cuda_options "-Xcudafe \"--display_error_number --diag_suppress=2976 --diag_suppress=2977 --diag_suppress=2978 --diag_suppress=2979 --diag_suppress=1835 --diag_suppress=611 --diag_suppress=186 --diag_suppress=128\" --expt-extended-lambda")
else()
message(FATAL_ERROR "CUDA is incompatible, version 9.2 10.1 and 10.2 is only supported")
endif()
......@@ -213,7 +214,7 @@ file(WRITE cuda_lib "${CUDA_cudart_static_LIBRARY} ${CUDA_cudadevrt_LIBRARY}")
file(WRITE cuda_include "-I${CUDA_INCLUDE_DIRS}")
file(WRITE mpi_include "-I${MPI_C_INCLUDE_DIRS}")
file(WRITE mpi_libs "${MPI_C_LINK_FLAGS} ${MPI_C_LIBRARIES}")
file(WRITE cuda_suppress_wr "${WARNING_SUPPRESSION_AND_OPTION_NVCC_TEXT}")
file(WRITE cuda_options "${WARNING_SUPPRESSION_AND_OPTION_NVCC_TEXT}")
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/src/config/config_cmake.h.in ${CMAKE_CURRENT_SOURCE_DIR}/src/config/config.h)
......
......@@ -10,10 +10,10 @@ OBJ = main.o update_new.o
mpif90 -ffree-line-length-none -fno-range-check -fno-second-underscore -fimplicit-none -mavx -O3 -c -g -o $@ $<
%.o: %.cpp
$(CC) -O3 -mavx -g -c --std=c++11 -Wno-ignored-attributes -o $@ $< $(INCLUDE_PATH) # -I/where/you/have/Vc
$(CC) -O3 -mavx -g -c --std=c++11 -Wno-ignored-attributes -o $@ $< $(INCLUDE_PATH)
gray_scott: $(OBJ)
$(CC) -o $@ $^ $(CFLAGS) $(LIBS_PATH) $(LIBS) -L/home/i-bird/VCDEVEL/lib # -lVc (Add -lVc if you use VCDevel)
$(CC) -o $@ $^ $(CFLAGS) $(LIBS_PATH) $(LIBS)
all: gray_scott
......
......@@ -76,12 +76,12 @@ void init(grid_dist_id<3,double,aggregate<double> > & OldU,
auto key = it.get();
// Old values U and V
OldU.get(key) = 1.0;
OldV.get(key) = 0.0;
OldU.get<0>(key) = 1.0;
OldV.get<0>(key) = 0.0;
// Old values U and V
NewU.get(key) = 0.0;
NewV.get(key) = 0.0;
NewU.get<0>(key) = 0.0;
NewV.get<0>(key) = 0.0;
++it;
}
......@@ -102,8 +102,8 @@ void init(grid_dist_id<3,double,aggregate<double> > & OldU,
{
auto key = it_init.get();
OldU.get(key) = 0.5 + (((double)std::rand())/RAND_MAX -0.5)/10.0;
OldV.get(key) = 0.25 + (((double)std::rand())/RAND_MAX -0.5)/20.0;
OldU.get<0>(key) = 0.5 + (((double)std::rand())/RAND_MAX -0.5)/10.0;
OldV.get<0>(key) = 0.25 + (((double)std::rand())/RAND_MAX -0.5)/20.0;
++it_init;
}
......@@ -119,8 +119,6 @@ void step(grid_dist_id<3, double, aggregate<double>> & OldU,
grid_key_dx<3> (& star_stencil_3D)[7],
double uFactor_s, double vFactor_s, double deltaT, double F, double K)
{
timer tt;
tt.start();
#ifndef FORTRAN_UPDATE
......@@ -224,9 +222,6 @@ void step(grid_dist_id<3, double, aggregate<double>> & OldU,
//! \cond [fort_update] \endcond
#endif
tt.stop();
std::cout << tt.getwct() << std::endl;
}
//! \cond [vectorization] \endcond
......@@ -306,6 +301,8 @@ int main(int argc, char* argv[])
timer tot_sim;
tot_sim.start();
auto & v_cl = create_vcluster();
static grid_key_dx<3> star_stencil_3D[7] = {{0,0,0},
{0,0,-1},
{0,0,1},
......@@ -316,8 +313,10 @@ int main(int argc, char* argv[])
for (size_t i = 0; i < timeSteps; ++i)
{
if (i % 1 == 0)
if (i % 100 == 0 && v_cl.rank() == 0)
{
std::cout << "STEP: " << i << std::endl;
}
/*!
* \page Grid_3_gs_3D_vector Gray Scott in 3D fast implementation with vectorization
......
......@@ -192,6 +192,9 @@ void init_ring(grid_type & gr, const Box<3,float> & domain)
++it;
}
gr.write("Initialization");
return;
}
struct poisson_nn_helm
......@@ -788,6 +791,9 @@ int main(int argc, char* argv[])
// initialize the ring step 1
init_ring(g_vort,domain);
openfpm_finalize();
return 0;
x_.resize(g_vort.size(),g_vort.getLocalDomainSize());
x_.setZero();
......
......@@ -5,16 +5,18 @@ CC=mpic++
LDIR =
OBJ = main.o
gray_scott_sparse_test: OPT += -DTEST_RUN
gray_scott_sparse_test: gray_scott_sparse
%.o: %.cpp
$(CC) -O3 -g -c --std=c++11 -o $@ $< $(INCLUDE_PATH)
$(CC) -O3 -g $(OPT) -c --std=c++11 -o $@ $< $(INCLUDE_PATH)
gray_scott_sparse: $(OBJ)
$(CC) -o $@ $^ $(CFLAGS) $(LIBS_PATH) $(LIBS)
all: gray_scott_sparse
run: all
run: gray_scott_sparse_test
mpirun -np 4 ./gray_scott_sparse
.PHONY: clean all run
......
......@@ -127,7 +127,11 @@ int main(int argc, char* argv[])
double dv = 1*1e-5;
// Number of timesteps
#ifdef TEST_RUN
size_t timeSteps = 200;
#else
size_t timeSteps = 5000;
#endif
// K and F (Physical constant in the equation)
double K = 0.053;
......@@ -158,9 +162,12 @@ int main(int argc, char* argv[])
timer tot_sim;
tot_sim.start();
for (size_t i = 0; i < 100/*timeSteps*/; ++i)
auto & v_cl = create_vcluster();
for (size_t i = 0; i < timeSteps; ++i)
{
std::cout << "STEP: " << i << std::endl;
if (v_cl.rank() == 0)
{std::cout << "STEP: " << i << std::endl;}
/* if (i % 300 == 0)
{
std::cout << "STEP: " << i << std::endl;
......
......@@ -5,16 +5,18 @@ CC=mpic++
LDIR =
OBJ = main.o
gray_scott_sparse_cs_test: OPT += -DTEST_RUN
gray_scott_sparse_cs_test: gray_scott_sparse_cs
%.o: %.cpp
$(CC) -O3 -g -c --std=c++11 -o $@ $< $(INCLUDE_PATH)
$(CC) -O3 -g $(OPT) -c --std=c++11 -o $@ $< $(INCLUDE_PATH)
gray_scott_sparse_cs: $(OBJ)
$(CC) -o $@ $^ $(CFLAGS) $(LIBS_PATH) $(LIBS)
all: gray_scott_sparse_cs
run: all
run: gray_scott_sparse_cs_test
mpirun -np 4 ./gray_scott_sparse_cs
.PHONY: clean all run
......
......@@ -192,8 +192,13 @@ int main(int argc, char* argv[])
// Diffusion constant for specie V
double dv = 1*1e-5;
#ifdef TEST_RUN
// Number of timesteps
size_t timeSteps = 200;
#else
// Number of timesteps
size_t timeSteps = 150000;
#endif
// K and F (Physical constant in the equation)
double K = 0.053;
......@@ -219,6 +224,8 @@ int main(int argc, char* argv[])
double uFactor = deltaT * du/(spacing[x]*spacing[x]);
double vFactor = deltaT * dv/(spacing[x]*spacing[x]);
auto & v_cl = create_vcluster();
Old.write("Init_condition");
timer tot_sim;
......@@ -389,7 +396,8 @@ int main(int argc, char* argv[])
count++;
}
std::cout << "STEP: " << i << " " << std::endl;
if (v_cl.rank() == 0)
{std::cout << "STEP: " << i << " " << std::endl;}
if (i % 300 == 0)
{
Old.write_frame("out",i);
......
......@@ -12,6 +12,9 @@ else
CUDA_CC_LINK=nvcc -ccbin=mpic++
endif
gray_scott_sparse_gpu_test: OPT += -DTEST_RUN
gray_scott_sparse_gpu_test: gray_scott_sparse_gpu
CC=mpic++
LDIR =
......@@ -19,14 +22,14 @@ LDIR =
OBJ = main.o
%.o: %.cu
$(CUDA_CC) -O3 -g -c --std=c++11 -o $@ $< $(INCLUDE_PATH_NVCC)
$(CUDA_CC) -O3 $(OPT) -g -c --std=c++11 -o $@ $< $(INCLUDE_PATH_NVCC)
gray_scott_sparse_gpu: $(OBJ)
$(CUDA_CC) -o $@ $^ $(CFLAGS) $(LIBS_PATH) $(LIBS)
all: gray_scott_sparse_gpu
run: all
run: gray_scott_sparse_gpu_test
mpirun -np 4 ./gray_scott_sparse_gpu
.PHONY: clean all run
......
......@@ -151,7 +151,11 @@ int main(int argc, char* argv[])
float dv = 1*1e-5;
// Number of timesteps
#ifdef TEST_RUN
size_t timeSteps = 300;
#else
size_t timeSteps = 15000;
#endif
// K and F (Physical constant in the equation)
float K = 0.053;
......@@ -172,12 +176,15 @@ int main(int argc, char* argv[])
float uFactor = deltaT * du/(spacing[x]*spacing[x]);
float vFactor = deltaT * dv/(spacing[x]*spacing[x]);
auto & v_cl = create_vcluster();
timer tot_sim;
tot_sim.start();
for (size_t i = 0; i < timeSteps ; ++i)
{
std::cout << "STEP: " << i << std::endl;
if (v_cl.rank() == 0)
{std::cout << "STEP: " << i << std::endl;}
/* if (i % 300 == 0)
{
std::cout << "STEP: " << i << std::endl;
......
......@@ -12,6 +12,9 @@ else
CUDA_CC_LINK=nvcc -ccbin=mpic++
endif
gray_scott_sparse_gpu_test: OPT += -DTEST_RUN
gray_scott_sparse_gpu_test: gray_scott_sparse_gpu
CC=mpic++
LDIR =
......@@ -19,14 +22,14 @@ LDIR =
OBJ = main.o
%.o: %.cu
$(CUDA_CC) -O3 -g -c --std=c++11 -o $@ $< $(INCLUDE_PATH_NVCC)
$(CUDA_CC) $(OPT) -O3 -g -c --std=c++11 -o $@ $< $(INCLUDE_PATH_NVCC)
gray_scott_sparse_gpu: $(OBJ)
$(CUDA_CC) -o $@ $^ $(CFLAGS) $(LIBS_PATH) $(LIBS)
all: gray_scott_sparse_gpu
run: all
run: gray_scott_sparse_gpu_test
mpirun -np 4 ./gray_scott_sparse_gpu
.PHONY: clean all run
......
......@@ -150,8 +150,13 @@ int main(int argc, char* argv[])
// Diffusion constant for specie V
double dv = 1*1e-5;
#ifdef TEST_RUN
// Number of timesteps
size_t timeSteps = 300;
#else
// Number of timesteps
size_t timeSteps = 150000;
#endif
// K and F (Physical constant in the equation)
double K = 0.053;
......@@ -170,8 +175,7 @@ int main(int argc, char* argv[])
init(grid,domain);
// sync the ghost
size_t count = 0;
grid.template ghost_get<U,V>();
grid.template ghost_get<U,V>(RUN_ON_DEVICE);
// because we assume that spacing[x] == spacing[y] we use formula 2
// and we calculate the prefactor of Eq 2
......
......@@ -5,16 +5,18 @@ CC=mpic++
LDIR =
OBJ = main.o
gray_scott_sparse_opt_test: OPT += -DTEST_RUN
gray_scott_sparse_opt_test: gray_scott_sparse_opt
%.o: %.cpp
$(CC) -mavx -g -O3 -c --std=c++11 -o $@ $< $(INCLUDE_PATH)
$(CC) -mavx -O3 -g $(OPT) -c --std=c++11 -o $@ $< $(INCLUDE_PATH)
gray_scott_sparse_opt: $(OBJ)
$(CC) -o $@ $^ $(CFLAGS) $(LIBS_PATH) $(LIBS)
all: gray_scott_sparse_opt
run: all
run: gray_scott_sparse_opt_test
mpirun -np 4 ./gray_scott_sparse_opt
.PHONY: clean all run
......
......@@ -152,7 +152,11 @@ int main(int argc, char* argv[])
double dv = 1*1e-5;
// Number of timesteps
#ifdef TEST_RUN
size_t timeSteps = 200;
#else
size_t timeSteps = 5000;
#endif
// K and F (Physical constant in the equation)
double K = 0.053;
......@@ -181,9 +185,12 @@ int main(int argc, char* argv[])
timer tot_sim;
tot_sim.start();
auto & v_cl = create_vcluster();
for (size_t i = 0; i < timeSteps ; ++i)
{
std::cout << "STEP: " << i << std::endl;
if (v_cl.rank() == 0)
{std::cout << "STEP: " << i << std::endl;}
/* if (i % 300 == 0)
{
std::cout << "STEP: " << i << std::endl;
......@@ -195,7 +202,7 @@ int main(int argc, char* argv[])
auto func = [uFactor,vFactor,deltaT,F,K](Vc::double_v & u_out,Vc::double_v & v_out,
Vc::double_v & u,Vc::double_v & v,
cross_stencil & uc,cross_stencil & vc,
cross_stencil_v & uc,cross_stencil_v & vc,
unsigned char * mask){
u_out = u + uFactor *(uc.xm + uc.xp +
......
......@@ -498,7 +498,7 @@ int main(int argc, char* argv[])
{
// We write the particle position for visualization (Without ghost)
vd.deleteGhost();
vd.write("particles_",f);
vd.write_frame("particles_",f);
// we resync the ghost
vd.ghost_get<>();
......
......@@ -114,7 +114,7 @@ int main(int argc, char* argv[])
if (i % 100 == 0)
{
vd.deleteGhost();
vd.write("particles_",f);
vd.write_frame("particles_",f);
vd.ghost_get<>();
vd.updateCellList(NN);
......
......@@ -114,7 +114,7 @@ int main(int argc, char* argv[])
if (i % 100 == 0)
{
vd.deleteGhost();
vd.write("particles_",f);
vd.write_frame("particles_",f);
vd.ghost_get<>();
vd.updateCellList(NN);
......
......@@ -404,7 +404,7 @@ int main(int argc, char* argv[])
{
// We write the particle position for visualization (Without ghost)
vd.deleteGhost();
vd.write("particles_",f);
vd.write_frame("particles_",f);
// we resync the ghost
vd.ghost_get<>(SKIP_LABELLING);
......
......@@ -255,10 +255,6 @@ public:
*/
__host__ ite_gpu<1> getDomainIteratorGPU(size_t n_thr = 1024) const
{
#ifdef SE_CLASS3
se3.getIterator();
#endif
return v_pos.getGPUIteratorTo(g_m,n_thr);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment