Skip to content

Commit

Permalink
Merge pull request #197 from jeffhammond/flang-new
Browse files Browse the repository at this point in the history
LLVM Flang flang-new support
  • Loading branch information
tomdeakin committed May 13, 2024
2 parents 3f7075b + 976350f commit 85fe83a
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 5 deletions.
4 changes: 3 additions & 1 deletion src/fortran/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ else ifeq ($(COMPILER),oneapi)
include make.inc.oneapi
else ifeq ($(COMPILER),gcc)
include make.inc.gcc
else ifeq ($(COMPILER),flang)
include make.inc.flang
else ifeq ($(COMPILER),amd)
include make.inc.amd
else ifeq ($(COMPILER),arm)
Expand All @@ -13,7 +15,7 @@ else ifeq ($(COMPILER),cray)
else ifeq ($(COMPILER),fj)
include make.inc.fj
else
$(info Set COMPILER={nvhpc,oneapi,amd,arm,cray,fj,gcc}. Default is gcc.)
$(info Set COMPILER={nvhpc,oneapi,amd,arm,cray,fj,flang,gcc}. Default is gcc.)
include make.inc.gcc
COMPILER=gcc
endif
Expand Down
11 changes: 8 additions & 3 deletions src/fortran/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ fi
if [ $(which crayftn) ] ; then
COMPILERS="${COMPILERS} cray"
fi
if [ $(which flang-new) ] ; then
COMPILERS="${COMPILERS} flang"
fi
if [ $(uname -m) == "aarch64" ] ; then
if [ $(which armflang) ] ; then
COMPILERS="${COMPILERS} arm"
Expand All @@ -26,14 +29,16 @@ if [ $(uname -m) == "aarch64" ] ; then
COMPILERS="${COMPILERS} fj"
fi
elif [ $(uname -m) == "x86_64" ] ; then
if [ $(which lscpu >& /dev/null && lscpu | grep GenuineIntel | awk '{print $3}') == "GenuineIntel" ] ; then
if [ "$(which lscpu >& /dev/null && lscpu | grep GenuineIntel | awk '{print $3}')" == "GenuineIntel" ] ; then
COMPILERS="${COMPILERS} oneapi"
if [ -f /opt/intel/oneapi/setvars.sh ] ; then
. /opt/intel/oneapi/setvars.sh >& /dev/null
fi
else
# ^ this detection can be improved
COMPILERS="${COMPILERS} amd"
if [ $(which flang) ] ; then
# ^ this detection can be improved
COMPILERS="${COMPILERS} amd"
fi
fi
fi

Expand Down
9 changes: 9 additions & 0 deletions src/fortran/make.inc.flang
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
FC := flang-new
FCFLAGS := -O3

DOCONCURRENT_FLAG =
ARRAY_FLAG =
OPENMP_FLAG = -fopenmp
OPENACC_FLAG =
CUDA_FLAG =
SEQUENTIAL_FLAG =
2 changes: 1 addition & 1 deletion src/fortran/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export ACC_NUM_CORES=${OMP_NUM_THREADS}

AFFCONTROL="numactl -N 0 -m 0 -C `seq -s "," 0 $((${OMP_NUM_THREADS}-1))`"

for compiler in gcc nvhpc cray oneapi arm amd fj ; do
for compiler in gcc flang nvhpc cray oneapi arm amd fj ; do
#if [ "x$compiler" == "xgcc" ] ; then
# export LD_PRELOAD=/usr/lib/gcc/aarch64-linux-gnu/11/libgomp.so
#fi
Expand Down

0 comments on commit 85fe83a

Please sign in to comment.