diff --git a/var/spack/repos/builtin/packages/globalarrays/ibm-xl.patch b/var/spack/repos/builtin/packages/globalarrays/ibm-xl.patch new file mode 100644 index 0000000000..644e3a559a --- /dev/null +++ b/var/spack/repos/builtin/packages/globalarrays/ibm-xl.patch @@ -0,0 +1,250 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 2022280..dac3b7f 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -174,6 +174,15 @@ option (F2C_HIDDEN_STRING_LENGTH_AFTER_ARGS "Set F77 macros" ON) + if (ENABLE_FORTRAN) + include( FortranCInterface ) + FortranCInterface_HEADER(${CMAKE_SOURCE_DIR}/f2c_cmake.h MACRO_NAMESPACE F77_FUNC_) ++ add_custom_command( ++ OUTPUT ${CMAKE_CURRENT_SOURCE_DIR}/f2c_cmake.fh ++ COMMAND ${CMAKE_COMMAND} -D INPUT:PATH="${CMAKE_CURRENT_SOURCE_DIR}/f2c_cmake.h" -D OUTPUT:PATH="${CMAKE_CURRENT_SOURCE_DIR}/f2c_cmake.fh" -P ${PROJECT_SOURCE_DIR}/tools/f2c_cmake_fh_from_h.cmake DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/f2c_cmake.h ++ DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/f2c_cmake.h ++ ) ++ add_custom_target( ++ GenerateF2c_cmakeFH ALL ++ DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/f2c_cmake.fh ++ ) + else() + CONFIGURE_FILE( ${CMAKE_SOURCE_DIR}/cmake/f2c_dummy.h.in + ${CMAKE_SOURCE_DIR}/f2c_cmake.h ) +@@ -336,6 +345,15 @@ if (ENABLE_FORTRAN) + set (F77_IARGC IARGC) + set (F77_FLUSH flush) + set (HAVE_F77_FLUSH 1) ++ elseif (CMAKE_Fortran_COMPILER MATCHES "xlf.*") ++ message(STATUS "Using IBM XL Fortran compiler settings") ++ set (F90_MODULE ) ++ set (F77_GETARG GETARG) ++ set (F77_GETARG_ARGS "i,s") ++ set (F77_GETARG_DECLS "intrinsic GETARG") ++ set (F77_IARGC IARGC) ++ set (F77_FLUSH flush_) ++ set (HAVE_F77_FLUSH 1) + endif() + else() + # need to set these variable even if only compiling C/C++ +diff --git a/cmake/config.h.in b/cmake/config.h.in +index 3ce6a32..9ad868f 100644 +--- a/cmake/config.h.in ++++ b/cmake/config.h.in +@@ -58,11 +58,11 @@ + + #cmakedefine01 F2C_HIDDEN_STRING_LENGTH_AFTER_ARGS + +-/*#define F77_FUNC(name,NAME) F77_FUNC_GLOBAL(name,NAME)*/ +-/*#define F77_FUNC_(name,NAME) F77_FUNC_GLOBAL_(name,NAME)*/ ++#define F77_FUNC(name,NAME) F77_FUNC_GLOBAL(name,NAME) ++#define F77_FUNC_(name,NAME) F77_FUNC_GLOBAL_(name,NAME) + +-#define F77_FUNC(name,NAME) name ## _ +-#define F77_FUNC_(name,NAME) name ## _ ++/* #define F77_FUNC(name,NAME) name ## _ */ ++/* #define F77_FUNC_(name,NAME) name ## _ */ + + #define FXX_MODULE ${F90_MODULE} + #define F77_GETARG ${F77_GETARG} +diff --git a/tools/config_fh_from_h.cmake b/tools/config_fh_from_h.cmake +index acdf776..fb10422 100644 +--- a/tools/config_fh_from_h.cmake ++++ b/tools/config_fh_from_h.cmake +@@ -7,6 +7,13 @@ if (INPUT) + foreach (l in ${in0}) + # Only retain lines that start with "#" + set(found "") ++ string(REGEX MATCH "^#include" found "${l}") ++ if (found) ++ # don't include f2c_cmake.h ++ set(out "#include \"f2c_cmake.fh\"\n") ++ continue () ++ endif () ++ set(found "") + string(REGEX MATCH "^#" found "${l}") + if (found) + set(out "${out}${l}\n") +diff --git a/tools/f2c_cmake_fh_from_h.cmake b/tools/f2c_cmake_fh_from_h.cmake +new file mode 100644 +index 0000000..acdf776 +--- /dev/null ++++ b/tools/f2c_cmake_fh_from_h.cmake +@@ -0,0 +1,21 @@ ++if (INPUT) ++ if (OUTPUT) ++ file(READ "${INPUT}" in0) ++# replace carriage returns with a semi-colon ++ string (REGEX REPLACE "\n" ";" in0 "${in0}") ++ set(out "") ++ foreach (l in ${in0}) ++ # Only retain lines that start with "#" ++ set(found "") ++ string(REGEX MATCH "^#" found "${l}") ++ if (found) ++ set(out "${out}${l}\n") ++ endif () ++ endforeach () ++ file(WRITE "${OUTPUT}" "${out}") ++ else (OUTPUT) ++ message(ERROR "OUTPUT variable must be set") ++ endif (OUTPUT) ++else (INPUT) ++ message(ERROR "INPUT variable must be set") ++endif (INPUT) +diff --git a/global/src/cnames.h b/global/src/cnames.h +index efdec60..cadfd0a 100644 +--- a/global/src/cnames.h ++++ b/global/src/cnames.h +@@ -2268,6 +2268,7 @@ + #define nga_iupdate_ghosts_ F77_FUNC_(nga_iupdate_ghosts,NGA_IUPDATE_GHOSTS) + #define nga_supdate_ghosts_ F77_FUNC_(nga_supdate_ghosts,NGA_SUPDATE_GHOSTS) + #define nga_zupdate_ghosts_ F77_FUNC_(nga_zupdate_ghosts,NGA_ZUPDATE_GHOSTS) ++#define nga_update_ghosts_nb_ F77_FUNC_(nga_update_ghosts_nb, NGA_UPDATE_GHOSTS_NB) + #define ga_update6_ghosts_ F77_FUNC_(ga_update6_ghosts, GA_UPDATE6_GHOSTS) + #define ga_cupdate6_ghosts_ F77_FUNC_(ga_cupdate6_ghosts,GA_CUPDATE6_GHOSTS) + #define ga_dupdate6_ghosts_ F77_FUNC_(ga_dupdate6_ghosts,GA_DUPDATE6_GHOSTS) +diff --git a/global/testing/perform.F b/global/testing/perform.F +index b18146d..e1b9641 100644 +--- a/global/testing/perform.F ++++ b/global/testing/perform.F +@@ -110,7 +110,7 @@ c + & ilo,ihi,jlo,jhi + write(6,*)'bytes loop get put', + & ' accumulate' +- call flush(6) ++ call F77_FLUSH(6) + endif + call ga_sync() + c +@@ -145,7 +145,7 @@ c + if (me .eq. 0) then + write(6,77)bytes, count, tg, 1d-6*bytes/tg, + & tp, 1d-6*bytes/tp, ta, 1d-6*bytes/ta +- call flush(6) ++ call F77_FLUSH(6) + endif + enddo + c +diff --git a/global/testing/mir_perf1.F b/global/testing/mir_perf1.F +index 074e838..3548552 100644 +--- a/global/testing/mir_perf1.F ++++ b/global/testing/mir_perf1.F +@@ -133,7 +133,7 @@ c + & ' accumulate' + write(6,*)' bytes dim sec MB/s sec MB/s', + & ' sec MB/s' +- call flush(6) ++ call F77_FLUSH(6) + endif + call ga_sync() + c +@@ -174,7 +174,7 @@ c + if (me .eq. 0) then + write(6,77)bytes, chunk(loop), tg, + & 1d-6*bytes/tg,tp, 1d-6*bytes/tp, ta, 1d-6*bytes/ta +- call flush(6) ++ call F77_FLUSH(6) + endif + enddo + c +@@ -388,7 +388,7 @@ c + & ' accumulate' + write(6,*)' bytes dim sec MB/s sec MB/s', + & ' sec MB/s' +- call flush(6) ++ call F77_FLUSH(6) + endif + call ga_sync() + c +@@ -427,7 +427,7 @@ c + if (me .eq. 0) then + write(6,77)bytes, chunk(loop), tg, + & 1d-6*bytes/tg,tp, 1d-6*bytes/tp, ta, 1d-6*bytes/ta +- call flush(6) ++ call F77_FLUSH(6) + endif + enddo + c +diff --git a/global/testing/mir_perf2.F b/global/testing/mir_perf2.F +index fb50398..3b3bed6 100644 +--- a/global/testing/mir_perf2.F ++++ b/global/testing/mir_perf2.F +@@ -124,7 +124,7 @@ c + & ' accumulate' + write(6,*)' bytes dim sec MB/s sec MB/s', + & ' sec MB/s' +- call flush(6) ++ call F77_FLUSH(6) + endif + call ga_sync() + c +@@ -163,7 +163,7 @@ c + if (me .eq. 0) then + write(6,77)bytes, chunk(loop), tg, + & 1d-6*bytes/tg,tp, 1d-6*bytes/tp, ta, 1d-6*bytes/ta +- call flush(6) ++ call F77_FLUSH(6) + endif + enddo + c +@@ -377,7 +377,7 @@ c + & ' accumulate' + write(6,*)' bytes dim sec MB/s sec MB/s', + & ' sec MB/s' +- call flush(6) ++ call F77_FLUSH(6) + endif + call ga_sync() + c +@@ -416,7 +416,7 @@ c + if (me .eq. 0) then + write(6,77)bytes, chunk(loop), tg, + & 1d-6*bytes/tg,tp, 1d-6*bytes/tp, ta, 1d-6*bytes/ta +- call flush(6) ++ call F77_FLUSH(6) + endif + enddo + c +diff --git a/global/testing/perfmod.F b/global/testing/perfmod.F +index ec3fe37..7770be7 100644 +--- a/global/testing/perfmod.F ++++ b/global/testing/perfmod.F +@@ -119,7 +119,7 @@ c + + write(6,*)'bytes loop get put', + & ' accumulate' +- call flush(6) ++ call F77_FLUSH(6) + endif + call ga_sync() + c +@@ -157,7 +157,7 @@ c + if (me .eq. 0) then + write(6,77)bytes, count, tg, 1d-6*bytes/tg, + & tp, 1d-6*bytes/tp, ta, 1d-6*bytes/ta +- call flush(6) ++ call F77_FLUSH(6) + endif + enddo + c +diff --git a/global/testing/sprsmatmult.F b/global/testing/sprsmatmult.F +index 3fdeb3f..3682c3b 100644 +--- a/global/testing/sprsmatmult.F ++++ b/global/testing/sprsmatmult.F +@@ -108,7 +108,7 @@ c + print *,'Comparing distributed multiply with serial multiply' + print * + #endif +- call flush(6) ++ call F77_FLUSH(6) + endif + c + c*** Initialize the MA package diff --git a/var/spack/repos/builtin/packages/globalarrays/package.py b/var/spack/repos/builtin/packages/globalarrays/package.py new file mode 100644 index 0000000000..bce1a8f37a --- /dev/null +++ b/var/spack/repos/builtin/packages/globalarrays/package.py @@ -0,0 +1,60 @@ +############################################################################## +# Copyright (c) 2013-2017, Lawrence Livermore National Security, LLC. +# Produced at IBM. +# +# This file is part of Spack. +# Created by Serban Maerean, serban@ibm.com, All rights reserved. +# LLNL-CODE-647188 +# +# For details, see https://github.com/llnl/spack +# Please also see the LICENSE file for our notice and the LGPL. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License (as +# published by the Free Software Foundation) version 2.1, February 1999. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the IMPLIED WARRANTY OF +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the terms and +# conditions of the GNU Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +############################################################################## +from spack import * + + +class Globalarrays(CMakePackage): + """The Global Arrays (GA) toolkit provides a shared memory style programming + environment in the context of distributed array data structures. + """ + + homepage = "http://hpc.pnl.gov/globalarrays/" + url = "https://github.com/GlobalArrays/ga" + + version('master', git='https://github.com/GlobalArrays/ga', branch='master') + + depends_on('blas') + depends_on('lapack') + depends_on('mpi') + + patch('ibm-xl.patch', when='%xl') + patch('ibm-xl.patch', when='%xl_r') + + def cmake_args(self): + options = [] + + options.extend([ + '-DENABLE_FORTRAN=ON', + '-DENABLE_BLAS=ON', + ]) + + if self.compiler.name == 'xl' or self.compiler.name == 'xl_r': + # use F77 compiler if IBM XL + options.extend([ + '-DCMAKE_Fortran_COMPILER=%s' % self.compiler.f77, + '-DCMAKE_Fortran_FLAGS=-qzerosize' + ]) + + return options