-
Notifications
You must be signed in to change notification settings - Fork 6
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
James Osborn
committed
Mar 7, 2017
1 parent
22523d8
commit 361a755
Showing
7 changed files
with
378 additions
and
8 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
NIM = @@NIM | ||
QEXDIR = @@QEXDIR | ||
QMPDIR = @@QMPDIR | ||
QIODIR = @@QIODIR | ||
CC = @@CC | ||
LD = @@LD | ||
CC_TYPE = @@CC_TYPE | ||
CFLAGS_ALWAYS = @@CFLAGS_ALWAYS | ||
CFLAGS_DEBUG = @@CFLAGS_DEBUG | ||
CFLAGS_SPEED = @@CFLAGS_SPEED | ||
VERBOSITY = @@VERBOSITY | ||
SIMD = @@SIMD | ||
VLEN = @@VLEN | ||
|
||
#### edit above | ||
|
||
ifneq ($(origin QEXDIR), undefined) | ||
ENVS += QEXDIR=$(QEXDIR) | ||
endif | ||
ifneq ($(origin QMPDIR), undefined) | ||
ENVS += QMPDIR=$(QMPDIR) | ||
endif | ||
ifneq ($(origin QIODIR), undefined) | ||
ENVS += QIODIR=$(QIODIR) | ||
endif | ||
ifneq ($(origin CC_TYPE), undefined) | ||
ENVS += CC_TYPE=$(CC_TYPE) | ||
endif | ||
ifneq ($(origin CC), undefined) | ||
ENVS += CC=$(CC) | ||
endif | ||
ifneq ($(origin LD), undefined) | ||
ENVS += LD=$(LD) | ||
endif | ||
ifneq ($(origin CFLAGS_ALWAYS), undefined) | ||
ENVS += CFLAGS_ALWAYS="$(CFLAGS_ALWAYS)" | ||
endif | ||
ifneq ($(origin CFLAGS_DEBUG), undefined) | ||
ENVS += CFLAGS_DEBUG="$(CFLAGS_DEBUG)" | ||
endif | ||
ifneq ($(origin CFLAGS_SPEED), undefined) | ||
ENVS += CFLAGS_SPEED="$(CFLAGS_SPEED)" | ||
endif | ||
ifneq ($(origin VERBOSITY), undefined) | ||
ENVS += VERBOSITY=$(VERBOSITY) | ||
endif | ||
ifneq ($(origin SIMD), undefined) | ||
ENVS += SIMD=$(SIMD) | ||
endif | ||
ifneq ($(origin VLEN), undefined) | ||
ENVS += VLEN=$(VLEN) | ||
endif | ||
|
||
DBG = "-d:release" | ||
ifeq ($(debug),1) | ||
DBG = "-d:debug" | ||
endif | ||
ifeq ($(run),1) | ||
DBG += "-r" | ||
endif | ||
ifeq ($(c),1) | ||
DBG += "-c" | ||
endif | ||
DBG += "--warning[SmallLshouldNotBeUsed]:off" | ||
DBG += "--hint[XDeclaredButNotUsed]:off" | ||
DBG += "--implicitStatic:on" | ||
#DBG += "--verbosity:2" | ||
#DBG += "--listCmd" | ||
#DBG += "--parallelBuild:4" | ||
#DBG += "--embedsrc" | ||
#DBG += "--genMapping" | ||
#DBG += "--gc:refc" | ||
#DBG += "--gc:markAndSweep" | ||
#refc|v2|markAndSweep|boehm|go|none | ||
|
||
TARGETS = $(MAKECMDGOALS) | ||
|
||
ifeq ($(TARGETS),clean) | ||
TARGETS = dummy | ||
endif | ||
clean: | ||
\rm -rf nimcache | ||
ifeq ($(TARGETS),all) | ||
T1 = $(wildcard $(QEXDIR)/src/*.nim) | ||
T2 = $(notdir $(T1)) | ||
T3 = $(basename $(T2)) | ||
T4 = $(filter-out simdQpx,$(T3)) | ||
TARGETS = $(T4) | ||
endif | ||
all: $(TARGETS) | ||
|
||
$(TARGETS): _force | ||
$(ENVS) $(NIM) c $(DBG) --nimcache:`pwd`/nimcache -o:`pwd`/$(@F) $(QEXDIR)/src/$@ | ||
|
||
.PHONY: _force |
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,16 @@ | ||
#!/bin/sh | ||
|
||
dir=`dirname $0` | ||
nim=`$dir/findNim` | ||
if [ "X`$nim`" = "X" ]; then | ||
#echo "Error: can't find Nim compiler 'nim'" | ||
#exit 1 | ||
#echo "Installing Nim compiler 'nim'" 1>&2 | ||
#dir=`dirname $0` | ||
$dir/installNim | ||
nim=`$dir/findNim` | ||
fi | ||
|
||
echo "Using Nim compiler: $nim" | ||
|
||
$nim $dir/configure.nims |
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,78 @@ | ||
import osPaths | ||
import strUtils | ||
|
||
var params = newSeq[string](0) | ||
template set(key,val: string) = | ||
params.insert val | ||
params.insert key | ||
template `~`(key,val: untyped) = | ||
set(astToStr(key), val) | ||
|
||
let nim = paramStr(0) | ||
NIM ~ nim | ||
|
||
let script = paramStr(1) | ||
#let qexdir = thisDir() | ||
let (qexdir, _, _) = splitFile(script) | ||
echo "Using QEXDIR ", qexdir | ||
set "QEXDIR", qexdir | ||
|
||
let home = getHomeDir() | ||
|
||
var qmpdir = home / "lqcd/install/qmp" | ||
echo "Using QMPDIR ", qmpdir | ||
set "QMPDIR", qmpdir | ||
|
||
var qiodir = home / "lqcd/install/qio" | ||
echo "Using QIODIR ", qiodir | ||
set "QIODIR", qiodir | ||
|
||
var machine = "" | ||
CC ~ "mpicc" | ||
LD ~ "$(CC)" | ||
CC_TYPE ~ "gcc" | ||
CFLAGS_ALWAYS ~ "-Wall -std=gnu99 -march=native -ldl" | ||
CFLAGS_DEBUG ~ "-g3 -O0" | ||
CFLAGS_SPEED ~ "-g -O3" | ||
VERBOSITY ~ "1" | ||
SIMD ~ "" | ||
VLEN ~ "1" | ||
|
||
if dirExists "/bgsys": | ||
machine = "Blue Gene/Q" | ||
CC ~ qexdir / "mpixlc2" | ||
CFLAGS_ALWAYS ~ "" | ||
CFLAGS_DEBUG ~ "-g3 -O0" | ||
CFLAGS_SPEED ~ "-O3" | ||
VERBOSITY ~ "3" | ||
SIMD ~ "QPX" | ||
|
||
let uname = staticExec "uname" | ||
|
||
if machine=="" and uname=="Darwin": | ||
machine = "macOS" | ||
SIMD ~ "SSE,AVX" | ||
VLEN ~ "8" | ||
|
||
if machine=="" and fileExists "/proc/cpuinfo": | ||
# assume compute nodes are same as build nodes | ||
machine = "linux" | ||
SIMD ~ "SSE,AVX" | ||
VLEN ~ "8" | ||
|
||
# cray/modules | ||
# KNL | ||
# linux (/proc/cpuinfo) | ||
# check on linux/mac/vesta/cooley/theta | ||
# gcc/icc opt level | ||
|
||
var f = readFile(qexdir / "Makefile.in") | ||
f = replace(f, "$", "!DOLLAR!") | ||
f = replace(f, "#", "!HASH!") | ||
f = replace(f, "@@", "$") | ||
f = f % params | ||
f = replace(f, "!HASH!", "#") | ||
f = replace(f, "!DOLLAR!", "$") | ||
|
||
#echo f | ||
writeFile("Makefile", f) |
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,37 @@ | ||
#!/bin/sh | ||
|
||
whichNim() { | ||
nim=`which nim` | ||
if [ "X`$nim`" = "X" ]; then | ||
nim=`ls -1 $HOME/bin/nim 2>/dev/null |tail -n1` | ||
fi | ||
if [ "X`$nim`" = "X" ]; then | ||
nim=`ls -1 $HOME/bin/nim-[0-9]* 2>/dev/null |tail -n1` | ||
fi | ||
if [ "X`$nim`" = "X" ]; then | ||
nim=`ls -1 $HOME/bin/nim-* 2>/dev/null |tail -n1` | ||
fi | ||
if [ "X`$nim`" = "X" ]; then | ||
nim=`ls -1 $HOME/nim/Nim/bin/nim 2>/dev/null |tail -n1` | ||
fi | ||
if [ "X`$nim`" = "X" ]; then | ||
nim=`ls -1 $HOME/nim/Nim-[0-9]*/bin/nim 2>/dev/null |tail -n1` | ||
fi | ||
if [ "X`$nim`" = "X" ]; then | ||
nim=`ls -1 $HOME/nim/Nim-*/bin/nim 2>/dev/null |tail -n1` | ||
fi | ||
echo $nim | ||
} | ||
|
||
nim=`whichNim` | ||
|
||
#if [ "X`$nim`" = "X" ]; then | ||
#echo "Error: can't find Nim compiler 'nim'" | ||
#exit 1 | ||
#echo "Installing Nim compiler 'nim'" 1>&2 | ||
#dir=`dirname $0` | ||
#$dir/installNim | ||
#nim=`whichNim` | ||
#fi | ||
|
||
echo $nim |
Oops, something went wrong.