diff --git a/Makefile b/Makefile index 4923b55..747fab6 100644 --- a/Makefile +++ b/Makefile @@ -2,16 +2,15 @@ # This is the unified Makefile for the hybrid code # ################################################################################ -RUNDIR ?= phigrape +RUNDIR ?= run ETICS_LMAX ?= 2 ETICS_NMAX ?= 10 GPUARCH ?= sm_75 CUDAHOME ?= /usr/local/cuda MPIHOME ?= /home/meiron/local OPTIMIZATION ?= 3 -CFLAGS += -mcmodel=large CXXFLAGS += $(CFLAGS) -CUDAFLAGS = +CUDAFLAGS ?= CXX ?= g++ MPICC ?= mpicc @@ -23,18 +22,24 @@ default: hybrid-sapporo hybrid-yebisu: etics yebisu make -C grapite yebisu - make -C $(RUNDIR) grapite + make -C phigrape grapite + mkdir -p $(RUNDIR)/ + cp -rp phigrape/phigrape $(RUNDIR)/ hybrid-sapporo: etics sapporo make -C grapite sapporo - make -C $(RUNDIR) grapite + make -C phigrape grapite + cp -rp phigrape/phigrape $(RUNDIR)/ plain-yebisu: yebisu - make -C $(RUNDIR) yebisu + make -C phigrape yebisu + mkdir -p $(RUNDIR)/ + cp -rp phigrape/phigrape $(RUNDIR)/ plain-sapporo: sapporo cp -rp sapporo2/testCodes/src/g6lib.h sapporo2/lib/grape6.h - make -C $(RUNDIR) sapporo + make -C phigrape sapporo + cp -rp phigrape/phigrape $(RUNDIR)/ etics: make -C etics/src library @@ -44,7 +49,9 @@ yebisu: sapporo: make -C sapporo2/lib - cd $(RUNDIR) && ln -s ../sapporo2/lib/CUDAKernels CUDA + mkdir -p $(RUNDIR)/ + rm -rf $(RUNDIR)/CUDA + cp -rp ../sapporo2/lib/CUDAKernels $(RUNDIR)/CUDA ################## @@ -58,6 +65,6 @@ clean: make -C yebisu clean make -C sapporo2/lib clean make -C grapite clean - make -C $(RUNDIR) clean + make -C phigrape clean .PHONY: default hybrid-yebisu hybrid-sapporo plain-yebisu plain-yebisu etics yebisu sapporo diff --git a/grapite b/grapite index 0d15503..aa58cd9 160000 --- a/grapite +++ b/grapite @@ -1 +1 @@ -Subproject commit 0d155035ce04cb12c1a1f09e6ae875f589c80281 +Subproject commit aa58cd9b21892ece6729fbdf9062746286ae2374 diff --git a/phigrape b/phigrape index 11c0db2..0a23445 160000 --- a/phigrape +++ b/phigrape @@ -1 +1 @@ -Subproject commit 11c0db23a3c3680fccffec7e53779a16e603f64c +Subproject commit 0a2344563d4916a0947f4da7f661a5206ace098e diff --git a/sapporo2/.gitignore b/sapporo2/.gitignore new file mode 100644 index 0000000..31198a0 --- /dev/null +++ b/sapporo2/.gitignore @@ -0,0 +1,5 @@ +* + +!.gitignore +!get_sapporo.sh +!patch.diff diff --git a/sapporo2/patch.diff b/sapporo2/patch.diff index e4091ed..0bbc0c5 100644 --- a/sapporo2/patch.diff +++ b/sapporo2/patch.diff @@ -20,19 +20,105 @@ diff -ruN __device__ __forceinline__ double atomicMin(double *address, double val) { diff -ruN +--- lib/include/cudadev.h ++++ +@@ -80,7 +80,7 @@ + assert(false);\ + } } + +-#define cuSafeCall( call ) CU_SAFE_CALL_NO_SYNC(call); ++#define cuSafeCall( call ) call; + + class context { + protected: +diff -ruN +--- lib/include/sapdevclass.h ++++ +@@ -33,7 +33,10 @@ + + #include + #include +-#include ++#define omp_get_num_procs() 1 ++#define omp_get_thread_num() 0 ++#define omp_get_num_threads() 1 ++#define omp_get_max_threads() 1 + + #include + +diff -ruN +--- lib/interfaces/sapporoG6lib.cpp ++++ +@@ -45,34 +45,9 @@ + + int g6_open_(int *id) + { +- //Check for a config file if its there use it +- id = id; //Make the compiler happy +- int *devList = NULL; +- int how_many = 0; +- FILE *fd; +- if ((fd = fopen("sapporo2.config", "r"))) { +- char line[256]; +- fprintf(stderr, "sapporo2::open - config file is found\n"); +- if(fgets(line, 256, fd) != NULL) +- sscanf(line, "%d", &how_many); +- +- //Read the devices we want to use +- if(how_many > 0) +- { +- devList = new int[how_many]; +- for (int i = 0; i < how_many; i++) { +- if(fgets(line, 256, fd) != NULL) +- sscanf(line, "%d", &devList[i]); +- } +- } +- } else { +- fprintf(stderr," sapporo2::open - no config file is found \n"); +- how_many = 0; +- } +- int res = g6_open_special(how_many, devList); +- +- delete[] devList; +- ++ int devList = *id; ++ int how_many = 1; ++ int res = g6_open_special(how_many, &devList); + return res; + } + +diff -ruN --- lib/Makefile +++ -@@ -5,7 +5,8 @@ +@@ -1,11 +1,13 @@ +-CXX = g++ +-CC = gcc +-LD = g++ +-F90 = ifort ++CXX ?= g++ ++CC ?= gcc ++LD ?= g++ ++F90 ?= ifort .SUFFIXES: .o .cpp .ptx .cu -CUDA_TK ?= /usr/local/cuda +CUDAHOME ?= /usr/local/cuda +CUDA_TK = $(CUDAHOME) ++OPTIMIZATION ?= 3 testRunFlags1= -@@ -36,17 +37,8 @@ +@@ -24,7 +26,7 @@ + testRunFlags3="-D TIMING_STATS=1" + endif + +-OFLAGS = -g -O3 -Wall -Wextra -Wstrict-aliasing=2 -fopenmp ++OFLAGS = -g -O$(OPTIMIZATION) -Wall -Wextra -Wstrict-aliasing=2 + + #Use below if compiling with CPU_SUPPORT (SSE) + #CXXFLAGS += ${testRunFlags} -fPIC $(OFLAGS) -I$(CUDA_TK)/include -msse4 +@@ -36,23 +38,14 @@ NVCC = $(CUDA_TK)/bin/nvcc @@ -48,7 +134,14 @@ diff -ruN -#NVCCFLAGS ?= -arch sm_30 -#NVCCFLAGS = -arch sm_20 +GPUARCH ?= sm_75 -+NVCCFLAGS = -arch $(GPUARCH) ++NVCCFLAGS = -arch $(GPUARCH) -ccbin $(CXX) NVCCFLAGS += ${testRunFlags} # Use with Mac OS X + # NVCCFLAGS = -arch sm_12 -Xcompiler="-Duint=unsigned\ int" + +-LDFLAGS = -lcuda -fopenmp ++LDFLAGS = -lcuda + + + INCLUDEPATH = ./include