forked from Mantevo/miniMD
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Get tool info from TOOLS variable and use base makefile for rules. Doesn't copy src files/makefile into build dirs.
- Loading branch information
Jason Sewall
committed
Feb 19, 2019
1 parent
eeb25f5
commit 7bc4388
Showing
2 changed files
with
47 additions
and
121 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,110 +1,52 @@ | ||
# Multiple-machine Makefile | ||
srcdir=. | ||
include $(srcdir)/Makefile.$(TOOLS) | ||
|
||
SHELL = /bin/sh | ||
PREFIX?=. | ||
|
||
# Files | ||
ROOT=miniMD | ||
TARGETS= | ||
TARGETS+=$(PREFIX)/$(ROOT)_$(TOOLS) | ||
CLEANFILES=$(TARGETS) | ||
|
||
SRC = ljs.cpp input.cpp integrate.cpp atom.cpp force_lj.cpp neighbor.cpp \ | ||
OBJ_DIR=$(PREFIX)/Obj_$(TOOLS) | ||
|
||
all: $(TARGETS) | ||
|
||
#======================================================================= | ||
|
||
SRC=ljs.cpp input.cpp integrate.cpp atom.cpp force_lj.cpp neighbor.cpp \ | ||
thermo.cpp comm.cpp timer.cpp output.cpp setup.cpp | ||
INC = ljs.h atom.h force.h neighbor.h thermo.h timer.h comm.h integrate.h threadData.h variant.h openmp.h \ | ||
INC=ljs.h atom.h force.h neighbor.h thermo.h timer.h comm.h integrate.h threadData.h variant.h openmp.h \ | ||
types.h miniMD_math.h | ||
|
||
# Definitions | ||
|
||
ROOT = miniMD | ||
EXE = $(ROOT)_$@ | ||
OBJ = $(SRC:.cpp=.o) | ||
|
||
# Help | ||
|
||
help: | ||
@echo 'Type "make target {Options}" where target is one of:' | ||
@echo ' openmpi (using OpenMPI)' | ||
@echo ' intel (using intelMPI)' | ||
@echo ' clang (using MPI-Stubs)' | ||
@echo ' cray (using CrayCompiler for CPUs)' | ||
@echo ' cray_intel (using Cray Wrapper for Intel compiler for CPUs)' | ||
@echo 'Options (not all of which apply for each target):' | ||
@echo ' KNC=yes (compile for XeonPhi)' | ||
@echo ' SP=yes (compile for single precision [32bit floats])' | ||
@echo ' DEBUG=yes (compile debug mode)' | ||
@echo ' AVX=yes (compile for avx [DEFAULT])' | ||
@echo ' SIMD=yes (use "pragma simd" [DEFAULT])' | ||
@echo ' RED_PREC=yes (use reduced precision math intrinsics)' | ||
@echo ' ANSI_ALIAS=yes (compile with ansi-alias flag)' | ||
@echo ' GSUNROLL=yes (compile with flags for XeonPhi which unroll gather/scatter operations [DEFAULT])' | ||
@echo ' LIBRT=yes (use librt for timing [more precise])' | ||
@echo ' PAD=[3,4] (pad data to 3 or 4 elements [default 3 = no padding])' | ||
@echo '(Good) Examples:' | ||
@echo ' Modern CPUs (Intel Sandy Bridge, AMD Interlagos or newer):' | ||
@echo ' make openmpi -j 32' | ||
@echo ' Intel Xeon Phi:' | ||
@echo ' make intel -j 32 KNC=yes ANSI_ALIAS=yes SIMD=no' | ||
|
||
# Targets | ||
|
||
openmpi: | ||
@if [ ! -d Obj_$@ ]; then mkdir Obj_$@; fi | ||
@cp -p $(SRC) $(INC) Obj_$@ | ||
@cp Makefile.$@ Obj_$@/Makefile | ||
@cd Obj_$@; \ | ||
$(MAKE) "OBJ = $(OBJ)" "INC = $(INC)" "EXE = ../$(EXE)" ../$(EXE) | ||
# @if [ -d Obj_$@ ]; then cd Obj_$@; rm $(SRC) $(INC) Makefile*; fi | ||
|
||
cray: | ||
@if [ ! -d Obj_$@ ]; then mkdir Obj_$@; fi | ||
@cp -p $(SRC) $(INC) Obj_$@ | ||
@cp Makefile.$@ Obj_$@/Makefile | ||
@cd Obj_$@; \ | ||
$(MAKE) "OBJ = $(OBJ)" "INC = $(INC)" "EXE = ../$(EXE)" ../$(EXE) | ||
|
||
cray_intel: | ||
@if [ ! -d Obj_$@ ]; then mkdir Obj_$@; fi | ||
@cp -p $(SRC) $(INC) Obj_$@ | ||
@cp Makefile.$@ Obj_$@/Makefile | ||
@cd Obj_$@; \ | ||
$(MAKE) "OBJ = $(OBJ)" "INC = $(INC)" "EXE = ../$(EXE)" ../$(EXE) | ||
|
||
intel: | ||
@if [ ! -d Obj_$@ ]; then mkdir Obj_$@; fi | ||
@cp -p $(SRC) $(INC) Obj_$@ | ||
@cp Makefile.$@ Obj_$@/Makefile | ||
@cd Obj_$@; \ | ||
$(MAKE) "OBJ = $(OBJ)" "INC = $(INC)" "EXE = ../$(EXE)" ../$(EXE) | ||
# @if [ -d Obj_$@ ]; then cd Obj_$@; rm $(SRC) $(INC) Makefile*; fi | ||
|
||
clang: | ||
if [ ! -d Obj_$@ ]; then mkdir Obj_$@; fi | ||
@cp -p $(SRC) $(INC) Obj_$@ | ||
@cp -r -p MPI-Stubs Obj_$@ | ||
@cp Makefile.$@ Obj_$@/Makefile | ||
@cd Obj_$@; \ | ||
$(MAKE) "OBJ = $(OBJ)" "INC = $(INC)" "EXE = ../$(EXE)" ../$(EXE) | ||
|
||
|
||
# Clean | ||
OBJ_base = $(SRC:.cpp=.o) | ||
OBJ= $(addprefix $(OBJ_DIR)/,$(OBJ_base)) | ||
DEP_base = $(SRC:.cpp=.d) | ||
DEP= $(addprefix $(OBJ_DIR)/,$(DEP_base)) | ||
|
||
clean: | ||
rm -r Obj_* | ||
LDFLAGS = $(COMMON_LDFLAGS) | ||
|
||
clean_openmpi: | ||
rm -r Obj_openmpi | ||
$(OBJ): | $(OBJ_DIR) | ||
|
||
clean_intel: | ||
rm -r Obj_intel | ||
$(DEP): | $(OBJ_DIR) | ||
|
||
clean_cray: | ||
rm -r Obj_cray | ||
|
||
clean_cray_intel: | ||
rm -r Obj_cray_intel | ||
$(OBJ_DIR): | ||
mkdir -p $(OBJ_DIR) | ||
|
||
# Test | ||
$(OBJ_DIR)/%.o: $(srcdir)/%.cpp $(INC) $(srcdir)/Makefile $(srcdir)/Makefile.$(TOOLS) | ||
$(OBJ_DIR)/%.o: $(srcdir)/%.cpp $(OBJ_DIR)/%.d $(srcdir)/Makefile $(srcdir)/Makefile.$(TOOLS) | ||
$(CC) -o $@ -c $< $(CCFLAGS) -MD | ||
|
||
scope=0 | ||
input=lj | ||
halfneigh=0 | ||
path="" | ||
-include $(DEPS) | ||
|
||
$(PREFIX)/$(ROOT)_$(TOOLS): $(OBJ) $(srcdir)/Makefile $(srcdir)/Makefile.$(TOOLS) | ||
$(LINK) $(OBJ) $(LINKFLAGS) $(USRLIB) $(SYSLIB)-o $@ | ||
$(SIZE) $@ | ||
|
||
CLEANFILES += $(OBJ) | ||
CLEANFILES += $(DEP) | ||
|
||
clean: | ||
rm -rf $(CLEANFILES) | ||
|
||
test: | ||
bash run_tests ${scope} ${input} ${halfneigh} ${path} | ||
#======================================================================= |
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