Commit 9ca2fc3f authored by Pillai, Himanshu's avatar Pillai, Himanshu
Browse files

inline

parent 0ad59aa6
......@@ -12,7 +12,7 @@ using std::max ;
namespace ELM {
void CanopyHydrology_FracH2OSfc(const double& dtime,
NATURE void CanopyHydrology_FracH2OSfc(const double& dtime,
const double& min_h2osfc,
const int& ltype,
const double& micro_sigma,
......
......@@ -10,7 +10,7 @@ using std::max ;
namespace ELM {
void CanopyHydrology_FracWet(const int& frac_veg_nosno,
NATURE void CanopyHydrology_FracWet(const int& frac_veg_nosno,
const double& h2ocan,
const double& elai,
const double& esai,
......
......@@ -12,7 +12,7 @@ using std::min ;
using std::max ;
namespace ELM {
void CanopyHydrology_Interception(double dtime,
NATURE void CanopyHydrology_Interception(double dtime,
const double& forc_rain,
const double& forc_snow,
const double& irrig_rate,
......
......@@ -13,7 +13,7 @@ using std::max ;
namespace ELM {
template<typename Array_d>
void CanopyHydrology_SnowWater(const double& dtime,
NATURE void CanopyHydrology_SnowWater(const double& dtime,
const double& qflx_floodg,
const int& ltype,
const int& ctype,
......
#ifndef ELM_CANOPY_HYDROLOGY_CPP_HH_
#define ELM_CANOPY_HYDROLOGY_CPP_HH_
#ifndef NATURE
#define NATURE
#endif
namespace ELM {
void CanopyHydrology_Interception(double dtime,
NATURE void CanopyHydrology_Interception(double dtime,
const double& forc_rain,
const double& forc_snow,
const double& irrig_rate,
......@@ -23,7 +27,7 @@ void CanopyHydrology_Interception(double dtime,
void CanopyHydrology_FracWet(const int& frac_veg_nosno,
NATURE void CanopyHydrology_FracWet(const int& frac_veg_nosno,
const double& h2ocan,
const double& elai,
const double& esai,
......@@ -33,7 +37,7 @@ void CanopyHydrology_FracWet(const int& frac_veg_nosno,
template<typename Array_d>
void CanopyHydrology_SnowWater(const double& dtime,
NATURE void CanopyHydrology_SnowWater(const double& dtime,
const double& qflx_floodg,
const int& ltype,
const int& ctype,
......@@ -65,7 +69,7 @@ void CanopyHydrology_SnowWater(const double& dtime,
double& frac_sno) ;
void CanopyHydrology_FracH2OSfc(const double& dtime,
NATURE void CanopyHydrology_FracH2OSfc(const double& dtime,
const double& min_h2osfc,
const int& ltype,
const double& micro_sigma,
......
......@@ -16,10 +16,10 @@ FC_FLAGS += -fimplicit-none -free -g3 -fbounds-check -fbacktrace
FC_LIB_ROOT = /usr/lib/gcc/x86_64-linux-gnu/8 #/usr/local/Cellar/gcc/8.2.0/lib/gcc/8
# assumes you have a working c++ compiler
CC = gcc
CXX = g++
MPICC = mpicc
MPICXX = mpic++
CC ?= gcc
CXX ?= g++
MPICC ?= mpicc
MPICXX ?= mpic++
CPP_FLAGS += -g -Wall -Wshadow -std=c++11
CXXFLAGS += -g -Wall -Wshadow -std=c++11
STD_LIB_ROOT = /usr
......@@ -55,7 +55,7 @@ CUDA_LD_FLAGS += -L$(SRCDIR) -lelm -L$(NETCDF_ROOT) -lnetcdf -L$(CUDA_LIBDIRS) -
%.cc.o: %.cc
$(CC) $(CC_FLAGS) $(CPP_FLAGS) $(INC_FLAGS) -c $< -o $@
%.cpp.o: %.cpp
$(CC) $(CC_FLAGS) $(CXXFLAGS) $(INC_FLAGS) -c $< -o $@
$(CXX) $(CC_FLAGS) $(CXXFLAGS) $(INC_FLAGS) -c $< -o $@
%.cu.o: %.cu
$(NVCC) $(CUDA_FLAGS) $(INC_FLAGS) -c $< -o $@
......
......@@ -2,6 +2,7 @@ OBJECT = ../../src/
KERNEL_FOLDER = cc
SRCDIR = $(OBJECT)$(KERNEL_FOLDER)
MPI = /usr/lib/x86_64-linux-gnu/openmpi/include
NATURE =
include $(OBJECT)config/Makefile.config
INC_FLAGS = -I$(NETCDF_ROOT)/include -I$(MPI) -I$(SRCDIR)
......
SRCDIR = ../../src/fortran/
CSRCDIR = ../../src/cc_fortran_wrappers/
OBJECT = ../../src/
NATURE =
include $(OBJECT)config/Makefile.config
......
......@@ -13,7 +13,7 @@
#include "utils.hh"
#include "readers.hh"
#include "CanopyHydrology.cpp"
#include "CanopyHydrology_cpp.hh"
namespace ELM {
......
......@@ -13,7 +13,7 @@
#include "utils.hh"
#include "readers.hh"
#include "CanopyHydrology.cpp"
#include "CanopyHydrology_cpp.hh"
namespace ELM {
......
......@@ -14,7 +14,7 @@
#include "readers.hh"
#include "CanopyHydrology.cpp"
#include "CanopyHydrology_cpp.hh"
#include "CanopyHydrology_SnowWater_impl.hh"
......
OBJECT = ../../src/
KERNEL_LANG = cc
SRCDIR = $(OBJECT)$(KERNEL_LANG)
NATURE = "__global__"
include $(OBJECT)config/Makefile.config
......
......@@ -181,7 +181,7 @@ int main(int argc, char ** argv)
// KOKKOS_LAMBDA (size_t g, size_t p) {
Kokkos::parallel_for("n_grid_cells", n_grid_cells, KOKKOS_LAMBDA (const size_t& g) {
for (size_t p = 0; p != n_pfts; ++p) {
ELM::CanopyHydrology_Interception(dtime,
ELM::CanopyHydrology_Interception(dtime,
forc_rain(t,g), forc_snow(t,g), forc_irrig(t,g),
ltype, ctype, urbpoi, do_capsnow,
elai(g,p), esai(g,p), dewmx, frac_veg_nosno,
......
......@@ -287,7 +287,7 @@ int main(int argc, char ** argv)
// NOTE: this currently punts on what to do with the qflx variables!
// Surely they should be either accumulated or stored on PFTs as well.
// --etc
ELM::CanopyHydrology_Interception(dtime,
ELM::CanopyHydrology_Interception(dtime,
forc_rain(t,g), forc_snow(t,g), forc_irrig(t,g),
ltype, ctype, urbpoi, do_capsnow,
elai(g,p), esai(g,p), dewmx, frac_veg_nosno,
......@@ -305,7 +305,7 @@ int main(int argc, char ** argv)
// By the PFT?
// --etc
double fwet = 0., fdry = 0.;
ELM::CanopyHydrology_FracWet(frac_veg_nosno, h2ocan(g,p), elai(g,p), esai(g,p), dewmx, fwet, fdry);
ELM::CanopyHydrology_FracWet(frac_veg_nosno, h2ocan(g,p), elai(g,p), esai(g,p), dewmx, fwet, fdry);
} // end PFT loop
// Column level operations
......@@ -327,7 +327,7 @@ int main(int argc, char ** argv)
//
// local outputs
int newnode;
ELM::CanopyHydrology_SnowWater(dtime, qflx_floodg,
ELM::CanopyHydrology_SnowWater(dtime, qflx_floodg,
ltype, ctype, urbpoi, do_capsnow, oldfflag,
forc_air_temp(t,g), t_grnd(g),
qflx_snow_grnd_col(g), qflx_snow_melt, n_melt, frac_h2osfc(g),
......@@ -341,7 +341,7 @@ int main(int argc, char ** argv)
// FIXME: Fortran black magic... h2osoi_liq is a vector, but the
// interface specifies a single double. For now passing the 0th
// entry. --etc
ELM::CanopyHydrology_FracH2OSfc(dtime, min_h2osfc, ltype, micro_sigma,
ELM::CanopyHydrology_FracH2OSfc(dtime, min_h2osfc, ltype, micro_sigma,
h2osno(g), h2osfc(g), h2osoi_liq(g,0), frac_sno(g), frac_sno_eff(g),
qflx_h2osfc2topsoi(g), frac_h2osfc(g));
......
/* ---------------------------------------------
Makefile constructed configuration:
Mon Jun 17 10:38:10 EDT 2019
Tue Jun 18 14:57:16 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:
Tue Jun 18 12:06:25 EDT 2019
Tue Jun 18 14:57:16 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."
......
......@@ -3,38 +3,50 @@ KOKKOS_DEBUG = "yes"
EXE_NAME1 = "test_CanopyHydrology_kern1_single"
EXE_NAME2 = "test_CanopyHydrology_kern1_multiple"
EXE_NAME3 = "test_CanopyHydrology_module"
OBJECT = ../../src/
KERNEL_FOLDER = cc
SRCDIR = $(OBJECT)$(KERNEL_FOLDER)
KOKKOS_DEVICES = $1
myDEVICE = Cuda
SRCDIR = ../../src/cc
KOKKOS_DEVICES = ${myDEVICE}
# ifeq ($(KOKKOS_DEVICES),$(myDEVICE))
# NATURE = KOKKOS_INLINE_FUNCTION
# ifeq ($(KOKKOS_DEVICES),Cuda)
# NATURE = KOKKOS_INLINE_FUNCTION
# CXX = ${KOKKOS_PATH}/bin/nvcc_wrapper
# EXE1 = ${EXE_NAME1}.cuda
# EXE2 = ${EXE_NAME2}.cuda
# EXE3 = ${EXE_NAME3}.cuda
# KOKKOS_ARCH = "BSW,Pascal60"
# KOKKOS_CUDA_OPTIONS = "enable_lambda,force_uvm"
# else
# NATURE =
# NATURE =
# CXX = g++
# EXE1 = ${EXE_NAME1}.host
# EXE2 = ${EXE_NAME2}.host
# EXE3 = ${EXE_NAME3}.host
# KOKKOS_ARCH = "BSW"
# endif
include $(OBJECT)config/Makefile.config
include $(SRCDIR)/../config/Makefile.config
TESTS = test_CanopyHydrology_kern1_single \
test_CanopyHydrology_kern1_multiple \
test_CanopyHydrology_module
TESTS1 = test_CanopyHydrology_kern1_multiple \
test_CanopyHydrology_module
SRC1 = CanopyHydrology_kern1_single.cpp
SRC2 = CanopyHydrology_kern1_multiple.cpp
SRC3 = CanopyHydrology_module.cpp
serial: build1 build2 build3 test
KOKKOS_DEVICES = "Serial"
Serial: build1 build2 build3 test
echo "Serial"
echo "Start Build"
openmp: build1 build2 build3 test
KOKKOS_DEVICES = "OpenMP"
OpenMP: build1 build2 build3 test
echo "OpenMP"
echo "Start Build"
cuda: build1 build2 build3 test
KOKKOS_DEVICES = "Cuda"
Cuda: build2 build3 test1
echo "Cuda"
echo "Start Build"
ifneq (,$(findstring Cuda,$(KOKKOS_DEVICES)))
......@@ -43,7 +55,7 @@ EXE1 = ${EXE_NAME1}.cuda
EXE2 = ${EXE_NAME2}.cuda
EXE3 = ${EXE_NAME3}.cuda
KOKKOS_ARCH = "BSW,Pascal60"
KOKKOS_CUDA_OPTIONS = "enable_lambda"
KOKKOS_CUDA_OPTIONS = "force_uvm,enable_lambda"
else
CXX = g++
EXE1 = ${EXE_NAME1}.host
......@@ -52,7 +64,7 @@ EXE3 = ${EXE_NAME3}.host
KOKKOS_ARCH = "BSW"
endif
CXXFLAGS = -g -O0
CXXFLAGS = -g -O0 -DNATURE=KOKKOS_INLINE_FUNCTION
LINK = ${CXX}
LINKFLAGS = -lnetcdf
EXTRA_PATH = -I$(NETCDF_ROOT)/include
......@@ -96,9 +108,18 @@ test : $(SRC1) $(SRC2) $(SRC3)
./$(EXE3) > test_CanopyHydrology_module.stdout
python ../compare_to_gold.py $(TESTS)
test1 : $(SRC2) $(SRC3)
./$(EXE1) > test_CanopyHydrology_kern1_single.stdout
./$(EXE2) > test_CanopyHydrology_kern1_multiple.stdout
./$(EXE3) > test_CanopyHydrology_module.stdout
python ../compare_to_gold.py $(TESTS1)
links:
@echo "making in links"
$(MAKE) -C ../links links
library:
$(MAKE) -C $(OBJECT) cc
\ No newline at end of file
$(MAKE) CXX=$(CXX) -C $(SRCDIR)
allclean: clean
$(MAKE) -C $(SRCDIR) clean
\ No newline at end of file
......@@ -6,6 +6,7 @@ endif
OBJECT = ../../src/
KERNEL_LANG = cc
SRCDIR = $(OBJECT)$(KERNEL_LANG)
NATURE =
# Flags for directing the runtime makefile what to include
DEBUG ?= 1 # Include debugging symbols
OUTPUT_LEVEL ?= LEVEL_DEBUG # Compile time logging level
......
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