summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Kroeker <martin@ruby.chemie.uni-freiburg.de>2022-08-04 20:42:18 +0200
committerGitHub <noreply@github.com>2022-08-04 20:42:18 +0200
commit85fd3c4279ad29636c24147be652d1cacdc30ae1 (patch)
treebdfc683d896df3e3fb7c4a67f4a9e58cd1051875
parent096ae6f2bd3c9cbe0ce2156cc949a4f7ca310ae8 (diff)
downloadopenblas-85fd3c4279ad29636c24147be652d1cacdc30ae1.tar.gz
openblas-85fd3c4279ad29636c24147be652d1cacdc30ae1.tar.bz2
openblas-85fd3c4279ad29636c24147be652d1cacdc30ae1.zip
Support compilation with the Cray C and Fortran compilers (#3712)
* Add support for the Cray Fortran compiler
-rw-r--r--Makefile.system26
-rw-r--r--cmake/fc.cmake11
-rw-r--r--cmake/system.cmake8
-rwxr-xr-xf_check9
-rw-r--r--f_check.pl10
5 files changed, 54 insertions, 10 deletions
diff --git a/Makefile.system b/Makefile.system
index 3be5efa0c..bada954c1 100644
--- a/Makefile.system
+++ b/Makefile.system
@@ -1190,7 +1190,6 @@ FCOMMON_OPT += -i8
endif
endif
endif
-
ifeq ($(ARCH), $(filter $(ARCH),mips64 mips))
ifndef BINARY64
FCOMMON_OPT += -n32
@@ -1200,11 +1199,9 @@ endif
ifeq ($(CORE), LOONGSON3R3)
FCOMMON_OPT += -loongson3 -static
endif
-
ifeq ($(CORE), LOONGSON3R4)
FCOMMON_OPT += -loongson3 -static
endif
-
else
ifndef BINARY64
FCOMMON_OPT += -m32
@@ -1212,7 +1209,6 @@ else
FCOMMON_OPT += -m64
endif
endif
-
ifeq ($(USE_OPENMP), 1)
FEXTRALIB += -lstdc++
FCOMMON_OPT += -mp
@@ -1220,7 +1216,6 @@ endif
endif
ifeq ($(C_COMPILER), OPEN64)
-
ifeq ($(ARCH), $(filter $(ARCH),mips64 mips))
ifndef BINARY64
CCOMMON_OPT += -n32
@@ -1230,13 +1225,10 @@ endif
ifeq ($(CORE), LOONGSON3R3)
CCOMMON_OPT += -loongson3 -static
endif
-
ifeq ($(CORE), LOONGSON3R4)
CCOMMON_OPT += -loongson3 -static
endif
-
else
-
ifndef BINARY64
CCOMMON_OPT += -m32
else
@@ -1282,6 +1274,19 @@ FCOMMON_OPT += -openmp
endif
endif
+ifeq ($(F_COMPILER), CRAY)
+CCOMMON_OPT += -DF_INTERFACE_INTEL
+FCOMMON_OPT += -hnopattern
+ifdef INTERFACE64
+ifneq ($(INTERFACE64), 0)
+FCOMMON_OPT += -s integer64
+endif
+endif
+ifneq ($(USE_OPENMP), 1)
+FCOMMON_OPT += -O noomp
+endif
+endif
+
ifdef BINARY64
ifdef INTERFACE64
ifneq ($(INTERFACE64), 0)
@@ -1565,6 +1570,11 @@ endif
ifeq ($(F_COMPILER),NAG)
LAPACK_FFLAGS := $(filter-out -msse3 -mssse3 -msse4.1 -mavx -mavx2 -mskylake-avx512 ,$(FFLAGS))
+FFLAGS := $(filter-out -msse3 -mssse3 -msse4.1 -mavx -mavx2 -mskylake-avx512 ,$(FFLAGS))
+endif
+ifeq ($(F_COMPILER),CRAY)
+LAPACK_FFLAGS := $(filter-out -msse3 -mssse3 -msse4.1 -mavx -mavx2 -mskylake-avx512 ,$(FFLAGS))
+FFLAGS := $(filter-out -msse3 -mssse3 -msse4.1 -mavx -mavx2 -mskylake-avx512 ,$(FFLAGS))
endif
LAPACK_CFLAGS = $(CFLAGS)
diff --git a/cmake/fc.cmake b/cmake/fc.cmake
index 94199605d..773feca6f 100644
--- a/cmake/fc.cmake
+++ b/cmake/fc.cmake
@@ -222,6 +222,17 @@ if (${F_COMPILER} STREQUAL "COMPAQ")
endif ()
endif ()
+if (${F_COMPILER} STREQUAL "CRAY")
+ set(CCOMMON_OPT "${CCOMMON_OPT} -DF_INTERFACE_INTEL")
+ set(FCOMMON_OPT "${FCOMMON_OPT} -hnopattern")
+ if (INTERFACE64)
+ set (FCOMMON_OPT "${FCOMMON_OPT} -s integer64")
+ endif ()
+ if (NOT USE_OPENMP)
+ set(FCOMMON_OPT "${FCOMMON_OPT} -O noomp")
+ endif ()
+endif ()
+
# from the root Makefile - this is for lapack-netlib to compile the correct secnd file.
if (${F_COMPILER} STREQUAL "GFORTRAN")
set(TIMER "INT_ETIME")
diff --git a/cmake/system.cmake b/cmake/system.cmake
index cb911ad56..a9fc0f4b7 100644
--- a/cmake/system.cmake
+++ b/cmake/system.cmake
@@ -559,6 +559,14 @@ if (${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
endforeach ()
endif ()
+if ("${F_COMPILER}" STREQUAL "NAG" OR "${F_COMPILER}" STREQUAL "CRAY")
+ set(FILTER_FLAGS "-msse3;-mssse3;-msse4.1;-mavx;-mavx2,-mskylake-avx512")
+ foreach (FILTER_FLAG ${FILTER_FLAGS})
+ string(REPLACE ${FILTER_FLAG} "" LAPACK_FFLAGS ${LAPACK_FFLAGS})
+ string(REPLACE ${FILTER_FLAG} "" LAPACK_FPFLAGS ${LAPACK_FPFLAGS})
+ endforeach ()
+endif ()
+
if ("${F_COMPILER}" STREQUAL "GFORTRAN")
# lapack-netlib is rife with uninitialized warnings -hpa
set(LAPACK_FFLAGS "${LAPACK_FFLAGS} -Wno-maybe-uninitialized")
diff --git a/f_check b/f_check
index 1499fa750..bb13e1640 100755
--- a/f_check
+++ b/f_check
@@ -45,7 +45,7 @@ if [ -z "$compiler" ]; then
pathf90 pathf95
pgf95 pgf90 pgf77 pgfortran nvfortran
flang egfortran
- ifort nagfor ifx"
+ ifort nagfor ifx ftn crayftn"
for list in $lists; do
for p in $path; do
@@ -82,6 +82,10 @@ else
vendor=FUJITSU
openmp='-Kopenmp'
;;
+ *Cray*)
+ vendor=CRAY
+ openmp='-fopenmp'
+ ;;
*GNU*|*GCC*)
v="${data#*GCC: *\) }"
@@ -295,6 +299,9 @@ fi
if [ "$vendor" = "NAG" ]; then
link=`$compiler $openmp -dryrun ftest2.f 2>&1 && rm -f a.out a.exe`
fi
+if [ "$vendor" = "CRAY" ]; then
+ link=`$compiler $openmp -hnopattern ftest2.f 2>&1 && rm -f a.out a.exe`
+fi
linker_L=""
linker_l=""
linker_a=""
diff --git a/f_check.pl b/f_check.pl
index 79e97b37f..cfc7331c2 100644
--- a/f_check.pl
+++ b/f_check.pl
@@ -34,7 +34,7 @@ if ($compiler eq "") {
"pathf90", "pathf95",
"pgf95", "pgf90", "pgf77", "pgfortran", "nvfortran",
"flang", "egfortran",
- "ifort", "nagfor", "ifx");
+ "ifort", "nagfor", "ifx", "ftn", "crayftn");
OUTER:
foreach $lists (@lists) {
@@ -76,6 +76,11 @@ if ($compiler eq "") {
$vendor = FUJITSU;
$openmp = "-Kopenmp";
+ } elsif ($data =~ /Cray/) {
+
+ $vendor = CRAY;
+ $openmp = "-fopenmp";
+
} elsif ($data =~ /GNU/ || $data =~ /GCC/ ) {
$data =~ s/\(+.*?\)+//g;
@@ -309,6 +314,9 @@ if (!$?) {
if ( $vendor eq "NAG") {
$link = `$compiler $openmp -dryrun ftest2.f 2>&1 && rm -f a.out a.exe`;
}
+if ( $vendor eq "CRAY") {
+ $link = `$compiler $openmp -hnopattern ftest2.f 2>&1 && rm -f a.out a.exe`;
+ }
$linker_L = "";
$linker_l = "";
$linker_a = "";