git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@13747 f3b2605a-c512-4ea7-a41b-209d697bcdaa

This commit is contained in:
sjplimp 2015-07-27 22:05:56 +00:00
parent fc4c6b0856
commit c0354ea1b5
2 changed files with 59 additions and 100 deletions

View File

@ -2,8 +2,7 @@
SHELL = /bin/sh
KOKKOS_ABSOLUTE_PATH = $(shell cd $(KOKKOS_PATH); pwd)
export OMPI_CXX = $(KOKKOS_ABSOLUTE_PATH)/config/nvcc_wrapper
export OMPI_CXX = ../../lib/config/nvcc_wrapper
# ---------------------------------------------------------------------
# compiler/linker settings

View File

@ -266,38 +266,27 @@ class Actions:
if caller == "file":
# add compiler/linker and default CCFLAGS,LINKFLAGS
# if cc.wrap, add wrapper setting for nvcc or mpi = ompi/mpich
# if cc.wwrap, add 2nd wrapper setting for mpi = ompi/mpich
# if cc.wrap, add wrapper setting for mpi = ompi/mpich
# precompiler = env variable setting for OpenMPI wrapper compiler
if cc:
make.setvar("CC",cc.compiler)
make.setvar("LINK",cc.compiler)
if cc.wrap:
if cc.wrap == "nvcc":
wrapper = os.path.abspath("../lib/kokkos/config/nvcc_wrapper")
else: wrapper = cc.wrap
abbrev = cc.abbrev
if abbrev == "nvcc":
make.addvar("CC","-ccbin=%s" % cc.wrap)
make.addvar("LINK","-ccbin=%s" % cc.wrap)
elif abbrev == "mpi":
if abbrev == "mpi":
txt = commands.getoutput("mpicxx -show")
if "-lmpich" in txt:
make.addvar("CC","-cxx=%s" % cc.wrap)
make.addvar("LINK","-cxx=%s" % cc.wrap)
make.addvar("CC","-cxx=%s" % wrapper)
make.addvar("LINK","-cxx=%s" % wrapper)
elif "-lmpi" in txt:
make.addvar("OMPI_CXX",cc.wrap,"cc")
precompiler = "env OMPI_CXX=%s " % cc.wrap
make.addvar("OMPI_CXX",wrapper,"cc")
precompiler = "env OMPI_CXX=%s " % wrapper
else: error("Could not add MPI wrapper compiler, " +
"did not recognize OpenMPI or MPICH")
if cc.wwrap:
txt = commands.getoutput("mpicxx -show")
if "-lmpich" in txt:
make.addvar("CC","-Xcompiler -cxx=%s" % cc.wwrap)
make.addvar("LINK","-Xcompiler -cxx=%s" % cc.wwrap)
elif "-lmpi" in txt:
make.addvar("OMPI_CXX",cc.wwrap,"cc")
precompiler = "env OMPI_CXX=%s " % cc.wwrap
else: error("Could not add MPI wrapper compiler, " +
"did not recognize OpenMPI or MPICH")
make.setvar("CCFLAGS","-g")
make.addvar("CCFLAGS","-O3")
make.setvar("LINKFLAGS","-g")
@ -333,69 +322,65 @@ class Actions:
make.addvar("MPI_LIB","-lmpi_stubs")
# add accelerator package CCFLAGS and LINKFLAGS and variables
# pre = "" if compiler not nvcc,
# else "-Xcompiler " to pass flag thru to wrapper compiler
compiler = precompiler + ' '.join(make.getvar("CC"))
linker = precompiler + ' '.join(make.getvar("LINK"))
if "nvcc" in compiler: pre = "-Xcompiler "
else: pre = ""
final = packages.final
if final["opt"]:
if compile_check(compiler,pre + "-restrict",0):
make.addvar("CCFLAGS",pre + "-restrict")
if compile_check(compiler,"-restrict",0):
make.addvar("CCFLAGS","-restrict")
if final["user-omp"]:
if compile_check(compiler,pre + "-restrict",0):
make.addvar("CCFLAGS",pre + "-restrict")
if compile_check(compiler,pre + "-fopenmp",1):
make.addvar("CCFLAGS",pre + "-fopenmp")
make.addvar("LINKFLAGS",pre + "-fopenmp")
if compile_check(compiler,"-restrict",0):
make.addvar("CCFLAGS","-restrict")
if compile_check(compiler,"-fopenmp",1):
make.addvar("CCFLAGS","-fopenmp")
make.addvar("LINKFLAGS","-fopenmp")
if final["user-intel"]:
if intel.mode == "cpu":
if compile_check(compiler,pre + "-fopenmp",1):
make.addvar("CCFLAGS",pre + "-fopenmp")
make.addvar("LINKFLAGS",pre + "-fopenmp")
make.addvar("CCFLAGS",pre + "-DLAMMPS_MEMALIGN=64")
if compile_check(compiler,pre + "-restrict",1):
make.addvar("CCFLAGS",pre + "-restrict")
if compile_check(compiler,pre + "-xHost",1):
make.addvar("CCFLAGS",pre + "-xHost")
make.addvar("LINKFLAGS",pre + "-xHost")
if compile_check(compiler,pre + "-fno-alias",1):
make.addvar("CCFLAGS",pre + "-fno-alias")
if compile_check(compiler,pre + "-ansi-alias",1):
make.addvar("CCFLAGS",pre + "-ansi-alias")
if compile_check(compiler,pre + "-override-limits",1):
make.addvar("CCFLAGS",pre + "-override-limits")
make.delvar("CCFLAGS",pre + "-DLMP_INTEL_OFFLOAD")
make.delvar("LINKFLAGS",pre + "-offload")
if compile_check(compiler,"-fopenmp",1):
make.addvar("CCFLAGS","-fopenmp")
make.addvar("LINKFLAGS","-fopenmp")
make.addvar("CCFLAGS","-DLAMMPS_MEMALIGN=64")
if compile_check(compiler,"-restrict",1):
make.addvar("CCFLAGS","-restrict")
if compile_check(compiler,"-xHost",1):
make.addvar("CCFLAGS","-xHost")
make.addvar("LINKFLAGS","-xHost")
if compile_check(compiler,"-fno-alias",1):
make.addvar("CCFLAGS","-fno-alias")
if compile_check(compiler,"-ansi-alias",1):
make.addvar("CCFLAGS","-ansi-alias")
if compile_check(compiler,"-override-limits",1):
make.addvar("CCFLAGS","-override-limits")
make.delvar("CCFLAGS","-DLMP_INTEL_OFFLOAD")
make.delvar("LINKFLAGS","-offload")
elif intel.mode == "phi":
if compile_check(compiler,pre + "-fopenmp",1):
make.addvar("CCFLAGS",pre + "-fopenmp")
make.addvar("LINKFLAGS",pre + "-fopenmp")
make.addvar("CCFLAGS",pre + "-DLAMMPS_MEMALIGN=64")
if compile_check(compiler,pre + "-restrict",1):
make.addvar("CCFLAGS",pre + "-restrict")
if compile_check(compiler,pre + "-xHost",1):
make.addvar("CCFLAGS",pre + "-xHost")
make.addvar("CCFLAGS",pre + "-DLMP_INTEL_OFFLOAD")
if compile_check(compiler,pre + "-fno-alias",1):
make.addvar("CCFLAGS",pre + "-fno-alias")
if compile_check(compiler,pre + "-ansi-alias",1):
make.addvar("CCFLAGS",pre + "-ansi-alias")
if compile_check(compiler,pre + "-override-limits",1):
make.addvar("CCFLAGS",pre + "-override-limits")
if compile_check(compiler,pre + '-offload-option,mic,compiler,' +
if compile_check(compiler,"-fopenmp",1):
make.addvar("CCFLAGS","-fopenmp")
make.addvar("LINKFLAGS","-fopenmp")
make.addvar("CCFLAGS","-DLAMMPS_MEMALIGN=64")
if compile_check(compiler,"-restrict",1):
make.addvar("CCFLAGS","-restrict")
if compile_check(compiler,"-xHost",1):
make.addvar("CCFLAGS","-xHost")
make.addvar("CCFLAGS","-DLMP_INTEL_OFFLOAD")
if compile_check(compiler,"-fno-alias",1):
make.addvar("CCFLAGS","-fno-alias")
if compile_check(compiler,"-ansi-alias",1):
make.addvar("CCFLAGS","-ansi-alias")
if compile_check(compiler,"-override-limits",1):
make.addvar("CCFLAGS","-override-limits")
if compile_check(compiler,'-offload-option,mic,compiler,' +
'"-fp-model fast=2 -mGLOB_default_function_attrs=' +
'\\"gather_scatter_loop_unroll=4\\""',1):
make.addvar("CCFLAGS",pre + '-offload-option,mic,compiler,' +
make.addvar("CCFLAGS",'-offload-option,mic,compiler,' +
'"-fp-model fast=2 -mGLOB_default_function_attrs=' +
'\\"gather_scatter_loop_unroll=4\\""')
if link_check(linker,"-offload",1):
make.addvar("LINKFLAGS",pre + "-offload")
make.addvar("LINKFLAGS","-offload")
if final["kokkos"]:
if kokkos.mode == "omp":
@ -403,9 +388,6 @@ class Actions:
make.delvar("KOKKOS_ARCH","*")
make.addvar("KOKKOS_DEVICES","OpenMP","lmp")
elif kokkos.mode == "cuda":
#if "nvcc" not in compiler:
# error("Kokkos/cuda build appears to not be " +
# "using NVIDIA nvcc compiler",0)
make.delvar("KOKKOS_DEVICES","*")
make.delvar("KOKKOS_ARCH","*")
make.addvar("KOKKOS_DEVICES","Cuda, OpenMP","lmp")
@ -1506,26 +1488,19 @@ class Cc:
def __init__(self,list):
self.inlist = list[:]
self.compiler = self.abbrev = ""
self.wrap = self.wabbrev = ""
self.wwrap = ""
self.wrap = ""
def help(self):
return """
-cc compiler wrap=wcompiler wwrap=wwcompiler
-cc compiler wrap=wcompiler
change CC setting in makefile
compiler is required, all other args are optional
compiler = any string with g++ or icc or icpc or nvcc
compiler = any string with g++ or icc or icpc
or mpi (or mpicxx, mpiCC, mpiicpc, etc)
can be compiler name or full path to compiler
mpi by itself is changed to mpicxx
wcompiler = g++ or icc or icpc or mpi (or mpicxx, mpiCC, mpiicpc, etc)
can only be used when compiler is a wrapper (mpi or nvcc)
mpi and variants can only be used with compiler = nvcc
mpi by itself is changed to mpicxx
specify compiler for wrapper to use in CC setting
wwcompiler = g++ or icc or icpc
can only be used when wcompiler is itself a wrapper (mpi)
specify compiler for wrapper of wrapper to use in CC setting
wcompiler = compiler for mpi wrapper to use
use nvcc for building for Kokkos/cuda with provided nvcc_wrapper
"""
def check(self):
@ -1537,34 +1512,19 @@ class Cc:
elif self.compiler.startswith("mpi"):
self.abbrev = "mpi"
elif self.compiler == "g++" or self.compiler == "icc" or \
self.compiler == "icpc" or self.compiler == "nvcc":
self.compiler == "icpc":
self.abbrev = self.compiler
elif "mpi" in self.compiler: self.abbrev = "mpi"
elif "g++" in self.compiler: self.abbrev = "g++"
elif "icc" in self.compiler: self.abbrev = "icc"
elif "icpc" in self.compiler: self.abbrev = "icpc"
elif "nvcc" in self.compiler: self.abbrev = "nvcc"
else: error("-cc args are invalid")
for one in self.inlist[1:]:
words = one.split('=')
if len(words) != 2: error("-cc args are invalid")
if words[0] == "wrap":
if self.abbrev != "mpi" and self.abbrev != "nvcc":
error("-cc compiler is not a wrapper")
if self.abbrev != "mpi": error("-cc compiler is not a wrapper")
self.wrap = words[1]
if self.wrap == "mpi":
self.wrap = "mpicxx"
self.wabbrev = "mpi"
elif self.wrap.startswith("mpi"):
self.wabbrev = "mpi"
elif self.compiler == "g++" or self.compiler == "icc" or \
self.compiler == "icpc":
self.wabbrev = self.wrap
elif words[0] == "wwrap":
self.wwrap = words[1]
if self.wabbrev != "mpi": error("-cc wrap is not a wrapper")
if self.wwrap != "g++" and self.wwrap != "icc" and self.wwrap != "icpc":
error("-cc args are invalid")
else: error("-cc args are invalid")
# Mpi class