Commit 05f2b006 authored by Coon, Ethan's avatar Coon, Ethan
Browse files

updates how rules and config are dealt with to allow differing libraries in differing tests

parent 990d1f56
......@@ -6,95 +6,78 @@
#define CONFIG_DONE
# Available from: git clone https://code.ornl.gov/isp/acme_inputdata
ELM_DATA_LOCATION ?= /home/7hp/Downloads/acme_inputdata
#ELM_DATA_LOCATION ?= /Users/uec/codes/elm/kernels/repos/acme_inputdata
# assumes you have a working NETCDF. This can easily be the version built by
# ATS as a part of an ATS installation.
NETCDF_ROOT ?= /usr/local
#NETCDF_ROOT ?= $(AMANZI_TPLS_DIR)
MPI_LIB_ROOT ?= /usr/lib/x86_64-linux-gnu/openmpi
ELM_UTILS_DIR = cime_utils
#
# COMPILERS
# =================================
#CC ?= gcc
CC ?= clang
# assumes you have a working gfortran
FC ?= gfortran
FC_FLAGS ?= -fimplicit-none -free -g3 -fbounds-check -fbacktrace
FC_LIB_ROOT ?= /usr/lib/gcc/x86_64-linux-gnu/8
#FC_LIB_ROOT ?= /usr/local/Cellar/gcc/8.2.0/lib/gcc/8
#CXX ?= g++
CXX ?= clang++
CXXFLAGS ?= -g -Wall -Wshadow -std=c++11
STD_LIB_ROOT = /usr
# assumes you have a working c++ compiler
CC ?= gcc
#CC ?= clang
#
# gfortran for fortran kernels
# ---------------------------------
FC ?= gfortran
FCFLAGS ?= -fimplicit-none -free -g3 -fbounds-check -fbacktrace
#FC_LIB_ROOT ?= /usr/lib/gcc/x86_64-linux-gnu/8
FC_LIB_ROOT ?= /usr/local/Cellar/gcc/8.2.0/lib/gcc/8
CXX ?= g++
#CXX ?= clang++
#
# REQUIRED LIBRARIES
# =================================
#
# requires MPI
# ---------------------------------
#MPI_LIB_ROOT ?= /usr/lib/x86_64-linux-gnu/openmpi
MPI_LIB_ROOT = /usr/local/Cellar/open-mpi/3.1.3
MPICC ?= mpicc
MPICXX ?= mpic++
MPI_INC_FLAGS = -I$(MPI_LIB_ROOT)/include
CXXFLAGS ?= -g -Wall -Wshadow -std=c++11
STD_LIB_ROOT = /usr
# assumes you have a working CUDA
NVCC=nvcc
CUDA_FLAGS ?= -std=c++11 -c -arch=sm_60
CUDA_LIBS= -lopenblas -lpthread -lcudart -lcublas
CUDA_LIBDIRS=/usr/local/cuda-10.0/lib64
CUDA_INCDIRS=-I/usr/local/cuda-10.0/include
# END of User specified things
#----------------------------------------
NETCDF_FLAGS = -L$(NETCDF_ROOT)/lib -lnetcdf
#
# requires NETCDF
# ---------------------------------
#NETCDF_ROOT ?= /usr/local
NETCDF_ROOT ?= $(AMANZI_TPLS_DIR)
NETCDF_FLAGS = -L$(NETCDF_ROOT)/lib -lnetcdf -lhdf5 -lhdf5_hl -lz
NETCDFF_FLAGS = -L$(NETCDF_ROOT)/lib -lnetcdff
NETCDF_INC_FLAGS = -I$(NETCDF_ROOT)/include
#
# requires ELM datasets
# ---------------------------------
# Available from: git clone https://code.ornl.gov/isp/acme_inputdata
#ELM_DATA_LOCATION ?= /home/7hp/Downloads/acme_inputdata
ELM_DATA_LOCATION ?= /Users/uec/codes/elm/kernels/repos/acme_inputdata
# this library
ELM_FLAGS = -L$(ELM_ROOT) -lelm
ELM_INC_FLAGS = -I$(ELM_ROOT)
GFORTRAN_FLAGS = -L$(FC_LIB_ROOT) -lgfortran
# linking flags
CC_LD_FLAGS += -L$(SRCDIR) -lelm -L$(NETCDF_ROOT) -lnetcdf -L$(STD_LIB_ROOT)/lib -lstdc++ -L$(FC_LIB_ROOT) -lgfortran
#CC_LD_FLAGS += -L$(SRCDIR) -lelm -L$(NETCDF_ROOT) -lnetcdf -L$(STD_LIB_ROOT)/lib -lstdc++ -L$(MPI_LIB_ROOT)/lib -L$(FC_LIB_ROOT) -lgfortran
FC_LD_FLAGS += -L$(ELM_ROOT) -lelm -L$(NETCDF_ROOT) -lnetcdff
CXX_LD_FLAGS += -L$(ELM_ROOT) -lelm -L$(NETCDF_ROOT) -lnetcdf
#CXX_LD_FLAGS += -L$(ELM_ROOT) -lelm -L$(NETCDF_ROOT) -lnetcdf -I$(MPI_LIB_ROOT)/include -L$(MPI_LIB_ROOT)/lib -lmpi
CUDA_LD_FLAGS = -L$(SRCDIR) -lelm -L$(NETCDF_ROOT) -lnetcdf -L$(CUDA_LIBDIRS) -lstdc++ -lpthread -lcudart -lcublas
#
# rules
# LIBRARIES FOR SPECIFIC TESTS
# =================================
#
.PHONY: all
.PRECIOUS: %.cc.o %.F90.o %.cpp.o %.cu.o
.SUFFIXES: .cc.o .F90.o .cpp.o .cu.o .cc .F90 .cpp .cu
%.F90.o: %.F90
$(FC) $(FC_FLAGS) -c $< -o $@
%.cc.o: %.cc
$(CC) $(CXXFLAGS) $(INC_FLAGS) -c $< -o $@
%.cpp.o: %.cpp
$(CXX) $(CXXFLAGS) $(KOKKOS_CXXFLAGS) $(NETCDF_INC_FLAGS) $(ELM_INC_FLAGS) -c $< -o $@ #-I$(MPI_LIB_ROOT)/include
%.cu.o: %.cu
$(NVCC) $(CUDA_FLAGS) -I$(MPI_LIB_ROOT)/include $(INC_FLAGS) -c $< -o $@
SHELL = /bin/sh
# Kokkos tests
# ---------------------------------
#KOKKOS_PATH ?= ${HOME}/Downloads/kokkos
KOKKOS_PATH ?= ${AMANZI_TPLS_BUILD_DIR}/trilinos/trilinos-12-14-1_master-source/packages/kokkos
LIB_SUFFIX=.a
M4 =
RM = rm -fr
CP = cp
XARGS =
AR = ar
######################################################################
# Rules used in all directories.
######################################################################
ELM_CLEAN=$(RM) -f *.o *.ii *.int.c *.log *.log.* stamp-* core core.* stats -r ti_files ii_files *.mod *.a
# assumes you have a working CUDA for CUDA builds
NVCC=nvcc
CUDA_FLAGS ?= -std=c++11 -c -arch=sm_60
CUDA_LIBS= -lopenblas -lpthread -lcudart -lcublas
CUDA_LIBDIRS=/usr/local/cuda-10.0/lib64
CUDA_INCDIRS=-I/usr/local/cuda-10.0/include
#
# Legion tests
# ---------------------------------
LG_RT_DIR ?= /Users/uec/codes/legion/repos/dev/
#endif
# compile flags
FCFLAGS += $(NETCDF_INC_FLAGS) $(ELM_INC_FLAGS)
CXXFLAGS += $(NETCDF_INC_FLAGS) $(ELM_INC_FLAGS)
# linking flags
FC_LD_FLAGS += $(NETCDF_FLAGS)
CXX_LD_FLAGS += $(NETCDF_FLAGS)
CUDA_LD_FLAGS = -L$(CUDA_LIBDIRS) -lstdc++ -lpthread -lcudart -lcublas
#
# rules
#
.PHONY: all
.PRECIOUS: %.cc.o %.F90.o %.cpp.o %.cu.o
.SUFFIXES: .cc.o .F90.o .cpp.o .cu.o .cc .F90 .cpp .cu
%.F90.o: %.F90
$(FC) $(FCFLAGS) -c $< -o $@
%.cpp.o: %.cpp
$(CXX) $(CXXFLAGS) $(KOKKOS_CXXFLAGS) $(NETCDF_INC_FLAGS) $(ELM_INC_FLAGS) -c $< -o $@ #-I$(MPI_LIB_ROOT)/include
%.cu.o: %.cu
$(NVCC) $(CUDA_FLAGS) -I$(MPI_LIB_ROOT)/include $(INC_FLAGS) -c $< -o $@
SHELL = /bin/sh
LIB_SUFFIX=.a
M4 =
RM = rm -fr
CP = cp
XARGS =
AR = ar
######################################################################
# Rules used in all directories.
######################################################################
ELM_CLEAN=$(RM) -f *.o *.ii *.int.c *.log *.log.* stamp-* core core.* stats -r ti_files ii_files *.mod *.a
#endif
......@@ -3,30 +3,30 @@ OBJECT = .
.PHONY: tests_c_c tests_legion_c tests_kokkos_c tests_c_f tests_f tests_legion_f tests_cuda
default: all
default: test
all: tests_c_c tests_legion_c tests_kokkos_c tests_c_f tests_f tests_legion_f tests_cuda
test: tests_c_c tests_legion_c tests_kokkos_c tests_c_f tests_f tests_legion_f tests_cuda
tests_c_c:
$(MAKE) -C tests_c_c all
$(MAKE) -C tests_c_c test
tests_cuda:
$(MAKE) -C tests_cuda all
$(MAKE) -C tests_cuda test
tests_legion_c:
$(MAKE) -C tests_legion_c all
$(MAKE) -C tests_legion_c test
tests_kokkos_c:
$(MAKE) -C tests_kokkos_c all
$(MAKE) -C tests_kokkos_c test
tests_c_f:
$(MAKE) -C tests_c_f all
$(MAKE) -C tests_c_f test
tests_f:
$(MAKE) -C tests_f all
$(MAKE) -C tests_f test
tests_legion_f:
$(MAKE) -C tests_legion_f all
$(MAKE) -C tests_legion_f test
clean:
$(MAKE) -C tests_c_c clean
......
......@@ -2,13 +2,9 @@ ELM_BASE = ../../src
KERNEL_FOLDER = cc
ELM_ROOT = $(ELM_BASE)/$(KERNEL_FOLDER)
# FC = mpifort
# CXX = mpicxx
# CC = mpicc
CXXFLAGS = -std=c++11 -g
include $(ELM_BASE)/config/Makefile.config
CXX = $(MPICXX)
include $(ELM_BASE)/config/Makefile.rules
TESTS = test_CanopyHydrology_kern1_single \
test_CanopyHydrology_kern1_multiple \
......@@ -40,7 +36,7 @@ CanopyHydrology_module: test_CanopyHydrology_module
test_%: %.cpp.o readers.hh utils.hh
$(CXX) -o $@ $< $(NETCDF_FLAGS)
$(CXX) -o $@ $< $(CXXFLAGS)
clean:
......
/* ---------------------------------------------
Makefile constructed configuration:
Thu Jul 18 13:47:00 EDT 2019
Tue Jul 23 11:03:01 EDT 2019
----------------------------------------------*/
#if !defined(KOKKOS_MACROS_HPP) || defined(KOKKOS_CORE_CONFIG_H)
#error "Do not include KokkosCore_config.h directly; include Kokkos_Macros.hpp instead."
......
/* ---------------------------------------------
Makefile constructed configuration:
Thu Jul 18 13:47:00 EDT 2019
Tue Jul 23 11:29:55 EDT 2019
----------------------------------------------*/
#if !defined(KOKKOS_MACROS_HPP) || defined(KOKKOS_CORE_CONFIG_H)
#error "Do not include KokkosCore_config.h directly; include Kokkos_Macros.hpp instead."
......
ELM_BASE = ../../src
KERNEL_FOLDER = cc
ELM_ROOT = $(ELM_BASE)/$(KERNEL_FOLDER)
MPI_LIB_ROOT = /usr/lib/x86_64-linux-gnu/openmpi
KOKKOS_PATH = ${HOME}/Downloads/kokkos
#KOKKOS_PATH = /Users/uec/codes/ats/amanzi-tpls/build-dev-tpetra/trilinos/trilinos-12-14-1_master-source/packages/kokkos
KOKKOS_DEBUG = "yes"
EXE_NAME1 = "test_CanopyHydrology_kern1_single"
......@@ -14,9 +8,6 @@ EXE_NAME2 = "test_CanopyHydrology_kern1_multiple"
EXE_NAME3 = "test_CanopyHydrology_module"
KOKKOS_DEVICES = ${myDEVICE}
FC = mpifort
CXX = mpicxx
CC = mpicc
# Get the Kokkos Device
ifneq (,$(findstring Cuda,$(KOKKOS_DEVICES)))
......@@ -36,20 +27,21 @@ KOKKOS_ARCH = "BSW"
endif
# Set the Kernel programming model
include $(ELM_BASE)/config/Makefile.config
FC = mpifort
CXX = mpicxx
CC = mpicc
CXXFLAGS += -DNATURE=KOKKOS_INLINE_FUNCTION
default: Serial
include $(ELM_BASE)/config/Makefile.rules
#include ELM
include $(ELM_BASE)/config/Makefile.config
default: Serial
# include Kokkos
include $(KOKKOS_PATH)/Makefile.kokkos
# CXXFLAGS += $(KOKKOS_CPPFLAGS) $(KOKKOS_CXXFLAGS)
# build the tess
# build the tests
TESTS = test_CanopyHydrology_kern1_single \
test_CanopyHydrology_kern1_multiple \
test_CanopyHydrology_module
......
Supports Markdown
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