-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
062c66a
commit 8794571
Showing
246 changed files
with
57,151 additions
and
8,748 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,196 @@ | ||
# Required paths | ||
ifndef LEGION_DIR | ||
$(error LEGION_DIR is not set) | ||
endif | ||
ifndef HTR_DIR | ||
$(error HTR_DIR is not set) | ||
endif | ||
|
||
# OS-specific options | ||
ifeq ($(shell uname),Darwin) | ||
DYNLINK_PATH := DYLD_LIBRARY_PATH | ||
else | ||
DYNLINK_PATH := LD_LIBRARY_PATH | ||
endif | ||
|
||
# CUDA options | ||
USE_CUDA ?= 1 | ||
|
||
# OpenMP options | ||
USE_OPENMP ?= 1 | ||
|
||
# HDF options | ||
export USE_HDF ?= 1 | ||
export HDF_HEADER ?= hdf5.h | ||
HDF_LIBNAME ?= hdf5 | ||
|
||
# FFT options | ||
export USE_FFTW ?= $(ELECTRIC_FIELD) | ||
export FFTW_HEADER ?= fftw3.h | ||
FFTW_LIBNAME ?= fftw3 -lfftw3_threads | ||
CUFFT_LIBNAME ?= cufft | ||
|
||
###################################################### | ||
# Baseline setup | ||
###################################################### | ||
# C and CUDA compilers options: | ||
# - Warnings | ||
C_FLAGS += -Wall -Werror -fno-strict-aliasing | ||
CXX_FLAGS += -Wall -Werror | ||
# - define standard | ||
CXX_FLAGS += -std=c++11 | ||
NVCC_FLAGS += -std=c++11 | ||
# - Include paths | ||
C_FLAGS += -I$(LEGION_DIR)/runtime -I$(LEGION_DIR)/bindings/regent -I$(HTR_DIR)/src -I$(HTR_DIR)/src/Mixtures -I$(HTR_DIR)/src/Utils -I. -I$(HTR_DIR)/src/Poisson -I. | ||
CXX_FLAGS += -I$(LEGION_DIR)/runtime -I$(LEGION_DIR)/bindings/regent -I$(HTR_DIR)/src -I$(HTR_DIR)/src/Mixtures -I$(HTR_DIR)/src/Utils -I. -I$(HTR_DIR)/src/Poisson -I. | ||
NVCC_FLAGS += -I$(LEGION_DIR)/runtime -I$(LEGION_DIR)/bindings/regent -I$(HTR_DIR)/src -I$(HTR_DIR)/src/Mixtures -I$(HTR_DIR)/src/Utils -I. -I$(HTR_DIR)/src/Poisson -I. | ||
|
||
# Regent options | ||
export TERRA_PATH := ?.rg;$(HTR_DIR)/src/?.rg;$(HTR_DIR)/src/Mixtures/?.rg;$(HTR_DIR)/src/Utils/?.rg;$(HTR_DIR)/src/Poisson/?.rg | ||
export INCLUDE_PATH := .;$(HTR_DIR)/src;$(HTR_DIR)/src/Mixtures;$(HTR_DIR)/src/Utils;$(HTR_DIR)/src/Poisson | ||
REGENT := $(LEGION_DIR)/language/regent.py | ||
REGENT_FLAGS := -fflow 0 -finner 1 -foffline 1 | ||
|
||
# Link flags | ||
LINK_FLAGS += -L$(LEGION_DIR)/bindings/regent -lregent | ||
LINK_FLAGS += -lm | ||
ifdef CRAYPE_VERSION | ||
LINK_FLAGS += -Bdynamic | ||
LINK_FLAGS += $(CRAY_UGNI_POST_LINK_OPTS) -lugni | ||
LINK_FLAGS += $(CRAY_UDREG_POST_LINK_OPTS) -ludreg | ||
endif | ||
|
||
###################################################### | ||
# If HDF5 is active | ||
###################################################### | ||
ifeq ($(USE_HDF), 1) | ||
ifdef HDF_ROOT | ||
export INCLUDE_PATH := $(INCLUDE_PATH);$(HDF_ROOT)/include | ||
export $(DYNLINK_PATH) := $($(DYNLINK_PATH)):$(HDF_ROOT)/lib | ||
LINK_FLAGS += -L$(HDF_ROOT)/lib | ||
endif | ||
LINK_FLAGS += -l$(HDF_LIBNAME) | ||
endif | ||
|
||
###################################################### | ||
# If FFTW is active | ||
###################################################### | ||
ifeq ($(USE_FFTW), 1) | ||
ifdef FFTW_ROOT | ||
export INCLUDE_PATH := $(INCLUDE_PATH);$(FFTW_ROOT)/include | ||
export $(DYNLINK_PATH) := $($(DYNLINK_PATH)):$(FFTW_ROOT)/lib | ||
C_FLAGS += -I$(FFTW_ROOT)/include | ||
CXX_FLAGS += -I$(FFTW_ROOT)/include | ||
NVCC_FLAGS += -I$(FFTW_ROOT)/include | ||
LINK_FLAGS += -L$(FFTW_ROOT)/lib | ||
endif | ||
LINK_FLAGS += -l$(FFTW_LIBNAME) | ||
ifeq ($(USE_CUDA), 1) | ||
LINK_FLAGS += -L$(CUDA_HOME)/lib64/stubs -l$(CUFFT_LIBNAME) | ||
endif | ||
endif | ||
|
||
###################################################### | ||
# If DEBUG mode is active | ||
###################################################### | ||
ifeq ($(DEBUG), 1) | ||
REGENT_FLAGS += -g -fbounds-checks 1 | ||
C_FLAGS += -g -O0 -DLEGION_BOUNDS_CHECKS -DLEGION_PRIVILEGE_CHECKS | ||
CXX_FLAGS += -g -O0 -DLEGION_BOUNDS_CHECKS -DLEGION_PRIVILEGE_CHECKS | ||
NVCC_FLAGS += -g -O0 -DLEGION_BOUNDS_CHECKS -DLEGION_PRIVILEGE_CHECKS -G | ||
LINK_FLAGS += -g | ||
else | ||
C_FLAGS += -O2 | ||
CXX_FLAGS += -O3 | ||
NVCC_FLAGS += -O3 | ||
endif | ||
|
||
###################################################### | ||
# If DEBUG_OUTPUT mode is active | ||
###################################################### | ||
ifneq ($(DEBUG_OUTPUT), 1) | ||
C_FLAGS += -DCHECK_MIX | ||
CXX_FLAGS += -DCHECK_MIX | ||
NVCC_FLAGS += -DCHECK_MIX | ||
endif | ||
|
||
###################################################### | ||
# If OpenMP is active | ||
###################################################### | ||
ifeq ($(USE_OPENMP), 1) | ||
C_FLAGS += -fopenmp | ||
CXX_FLAGS += -fopenmp | ||
REGENT_FLAGS += -fopenmp 1 | ||
else | ||
REGENT_FLAGS += -fopenmp 0 | ||
endif | ||
|
||
###################################################### | ||
# If CUDA is active | ||
###################################################### | ||
ifeq ($(USE_CUDA), 1) | ||
NVCC ?= $(CUDA_HOME)/bin/nvcc | ||
# Activate Regent's Cuda module only if we are not in debug mode | ||
ifneq ($(DEBUG), 1) | ||
REGENT_FLAGS += -fcuda 1 | ||
else | ||
REGENT_FLAGS += -fcuda 0 | ||
endif | ||
# Include thrust in C++ | ||
CXX_FLAGS += -I$(CUDA_HOME)/include | ||
# Link libcudadevrt for separate compilation of CUDA files | ||
LINK_FLAGS += -L$(CUDA_HOME)/lib64 -lcudadevrt | ||
# CUDA arch variables | ||
GPU_ARCH ?= auto | ||
# translate legacy arch names into numbers | ||
ifeq ($(strip $(GPU_ARCH)),fermi) | ||
GPU_ARCH_N = 20 | ||
endif | ||
ifeq ($(strip $(GPU_ARCH)),kepler) | ||
GPU_ARCH_N = 30 | ||
endif | ||
ifeq ($(strip $(GPU_ARCH)),k20) | ||
GPU_ARCH_N = 35 | ||
endif | ||
ifeq ($(strip $(GPU_ARCH)),k80) | ||
GPU_ARCH_N = 37 | ||
endif | ||
ifeq ($(strip $(GPU_ARCH)),maxwell) | ||
GPU_ARCH_N = 52 | ||
endif | ||
ifeq ($(strip $(GPU_ARCH)),pascal) | ||
GPU_ARCH_N = 60 | ||
endif | ||
ifeq ($(strip $(GPU_ARCH)),volta) | ||
GPU_ARCH_N = 70 | ||
endif | ||
ifeq ($(strip $(GPU_ARCH)),turing) | ||
GPU_ARCH_N = 75 | ||
endif | ||
ifeq ($(strip $(GPU_ARCH)),ampere) | ||
GPU_ARCH_N = 80 | ||
endif | ||
ifeq ($(strip $(GPU_ARCH)),auto) | ||
# detect based on what nvcc supports | ||
ALL_ARCHES = 20 30 32 35 37 50 52 53 60 61 62 70 72 75 80 | ||
GPU_ARCH_N = $(shell for X in $(ALL_ARCHES) ; do \ | ||
$(NVCC) -gencode arch=compute_$$X,code=sm_$$X -cuda -x c++ /dev/null -o /dev/null 2> /dev/null && echo $$X; \ | ||
done) | ||
endif | ||
# finally, convert space-or-comma separated list of architectures (e.g. 35,50) | ||
# into nvcc -gencode arguments | ||
COMMA=, | ||
NVCC_FLAGS += $(foreach X,$(subst $(COMMA), ,$(GPU_ARCH_N)),-gencode arch=compute_$(X)$(COMMA)code=sm_$(X)) | ||
else | ||
REGENT_FLAGS += -fcuda 0 | ||
endif | ||
|
||
####################################################### | ||
# Optional modules | ||
####################################################### | ||
ifeq ($(ELECTRIC_FIELD), 1) | ||
C_FLAGS += -DELECTRIC_FIELD | ||
CXX_FLAGS += -DELECTRIC_FIELD | ||
NVCC_FLAGS += -DELECTRIC_FIELD | ||
endif | ||
|
Oops, something went wrong.