-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathArch.mk
132 lines (114 loc) · 3.34 KB
/
Arch.mk
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
# Baselibs Build System
#
# System/site dependent options.
#
# REVISION HISTORY:
#
# 08Aug2008 da Silva Moved here from GNUmakefile for better CM.
#
#-------------------------------------------------------------------------
#
# ----------------
# Compiler
# ----------------
#
# Intel
# -----
ifneq ($(wildcard $(shell which ifort 2> /dev/null)),)
CPPFLAGS += -DpgiFortran
endif
ifneq ($(wildcard $(shell which ifx 2> /dev/null)),)
CPPFLAGS += -DpgiFortran
endif
# PGI
# ---
ifneq ($(wildcard $(shell which nvfortran 2> /dev/null)),)
CPPFLAGS += -DpgiFortran
PGI_FLAG = -PGI
endif
ifneq ($(wildcard $(shell which pgfortran 2> /dev/null)),)
CPPFLAGS += -DpgiFortran
PGI_FLAG = -PGI
endif
#
# ----------------
# Modules
# ----------------
#
ifneq ($(LMOD_CMD),)
LMODULECMD = $(LMOD_CMD)
else
MODULECMD = $(shell which modulecmd 2> /dev/null)
endif
#
# ----------------
# Python
# ----------------
#
PYTHON := $(dir $(shell which python))../
#
# ----------------
# Linux
# ----------------
#
ifeq ($(ARCH),Linux)
SITE := $(patsubst discover%,NCCS,$(SITE))
SITE := $(patsubst dali%,NCCS,$(SITE))
SITE := $(patsubst borg%,NCCS,$(SITE))
SITE := $(patsubst pfe%,NAS,$(SITE))
# This detects compute nodes at NAS
ifneq ($(shell uname -n | egrep 'r[0-9]*i[0-9]*n[0-9]*'),)
SITE := NAS
endif
ifneq ($(shell uname -n | egrep 'r[0-9]*c[0-9]*t[0-9]*n[0-9]*'),)
SITE := NAS
endif
CFLAGS := -fPIC
export CFLAGS
# Gentoo and Fedora put tiprc files in a weird place
ifneq (,$(wildcard /usr/include/tirpc/.))
INC_EXTRA += -I/usr/include/tirpc
LIB_EXTRA += -ltirpc
endif
ifeq ($(SITE),NCCS)
ENABLE_GPFS = --enable-gpfs
LINK_GPFS = -lgpfs
# On SLES15 at NCCS we need to link to libtirpc
OS_VERSION := $(shell grep VERSION_ID /etc/os-release | cut -d= -f2 | cut -d. -f1 | sed 's/"//g')
ifeq ($(OS_VERSION),15)
LIB_EXTRA += -ltirpc
endif
endif
# NAS is weird. The Intel compiler modules do not define
# CC, CXX, and FC. Thus, the Baselibs system only sees the
# definitions from the gcc module. This is to force intel at NAS
ifeq ($(SITE),NAS)
ifneq ($(wildcard $(shell which ifort 2> /dev/null)),)
FC := ifort
ES_FC := $(FC)
ESMF_COMPILER := intel
FC_FROM_ENV := FALSE
ifeq ($(ESMF_COMM),intelmpi)
MPIFC := mpiifort
CPPDEFS += -DpgiFortran
endif
endif
ifneq ($(wildcard $(shell which icc 2> /dev/null)),)
ES_CC := icc
ifeq ($(ESMF_COMM),intelmpi)
MPICC := mpiicc
endif
endif
ifneq ($(wildcard $(shell which icpc 2> /dev/null)),)
ES_CXX := icpc
ifeq ($(ESMF_COMM),intelmpi)
MPICXX := mpiicc
endif
endif
endif
ifeq ($(findstring gfortran,$(notdir $(FC))),gfortran)
FFLAGS += -fno-second-underscore
FCFLAGS += -fno-second-underscore
CPPFLAGS += -DgFortran
endif
endif