From 9e1800d81c37d72d9ab0fd1283b9a55df60e1012 Mon Sep 17 00:00:00 2001 From: Hironori-Yamaji <52182908+Hironori-Yamaji@users.noreply.github.com> Date: Tue, 3 Sep 2019 23:26:47 +0900 Subject: [PATCH] pmlib: new package (#12625) * pmlib: new package * pmlib: fix options and add patch * pmlib: fix the patch file --- .../packages/pmlib/fix_compiler_options.patch | 45 ++++++++++ .../repos/builtin/packages/pmlib/package.py | 87 +++++++++++++++++++ 2 files changed, 132 insertions(+) create mode 100644 var/spack/repos/builtin/packages/pmlib/fix_compiler_options.patch create mode 100644 var/spack/repos/builtin/packages/pmlib/package.py diff --git a/var/spack/repos/builtin/packages/pmlib/fix_compiler_options.patch b/var/spack/repos/builtin/packages/pmlib/fix_compiler_options.patch new file mode 100644 index 0000000000..ca28ab796e --- /dev/null +++ b/var/spack/repos/builtin/packages/pmlib/fix_compiler_options.patch @@ -0,0 +1,45 @@ +diff -ruN PMlib-org/cmake/CompileOptionSelector.cmake PMlib-fix/cmake/CompileOptionSelector.cmake +--- PMlib-org/cmake/CompileOptionSelector.cmake 2019-06-09 15:15:08.000000000 +0900 ++++ PMlib-fix/cmake/CompileOptionSelector.cmake 2019-09-02 10:53:45.124905538 +0900 +@@ -36,8 +36,8 @@ + endif() + + elseif (TARGET_ARCH STREQUAL "FX100") +- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Kfast -Nrt_notune -w -Xg") +- set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Kfast -Nrt_notune -w -Xg") ++ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Kfast -w -Nclang") ++ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Kfast -w -Nclang") + set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -Cpp -Kfast -Nrt_notune -Knooptmsg") + if(enable_PreciseTimer) + SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Nfjcex") +diff -ruN PMlib-org/cmake/Toolchain_fx100.cmake PMlib-fix/cmake/Toolchain_fx100.cmake +--- PMlib-org/cmake/Toolchain_fx100.cmake 2019-06-09 15:15:08.000000000 +0900 ++++ PMlib-fix/cmake/Toolchain_fx100.cmake 2019-09-03 17:37:51.504857455 +0900 +@@ -18,18 +18,18 @@ + include(CMakeForceCompiler) + + if(with_MPI) +- CMAKE_FORCE_C_COMPILER(mpifccpx GNU) +- CMAKE_FORCE_CXX_COMPILER(mpiFCCpx GNU) +- CMAKE_FORCE_Fortran_COMPILER(mpifrtpx GNU) ++ CMAKE_FORCE_C_COMPILER(mpicc GNU) ++ CMAKE_FORCE_CXX_COMPILER(mpicxx GNU) ++ CMAKE_FORCE_Fortran_COMPILER(mpifort GNU) + else() +- CMAKE_FORCE_C_COMPILER(fccpx GNU) +- CMAKE_FORCE_CXX_COMPILER(FCCpx GNU) +- CMAKE_FORCE_Fortran_COMPILER(frtpx GNU) ++ CMAKE_FORCE_C_COMPILER(fcc GNU) ++ CMAKE_FORCE_CXX_COMPILER(FCC GNU) ++ CMAKE_FORCE_Fortran_COMPILER(frt GNU) + endif() + +-set(CMAKE_FIND_ROOT_PATH /opt/FJSVmxlang/GM-2.0.0-05) +-set(CMAKE_INCLUDE_PATH /opt/FJSVmxlang/GM-2.0.0-05/include) +-set(CMAKE_LIBRARY_PATH /opt/FJSVmxlang/GM-2.0.0-05/lib64) ++#set(CMAKE_FIND_ROOT_PATH /opt/FJSVmxlang/GM-2.0.0-05) ++#set(CMAKE_INCLUDE_PATH /opt/FJSVmxlang/GM-2.0.0-05/include) ++#set(CMAKE_LIBRARY_PATH /opt/FJSVmxlang/GM-2.0.0-05/lib64) + + set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) + set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) diff --git a/var/spack/repos/builtin/packages/pmlib/package.py b/var/spack/repos/builtin/packages/pmlib/package.py new file mode 100644 index 0000000000..a6e721a62b --- /dev/null +++ b/var/spack/repos/builtin/packages/pmlib/package.py @@ -0,0 +1,87 @@ +# Copyright 2013-2019 Lawrence Livermore National Security, LLC and other +# Spack Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + +from spack import * + + +class Pmlib(CMakePackage): + """This library records the statistics information of run-time performance + and the trace information of a user code and reports its summary. + The PMlib is able to use for both serial and parallel environments + including hybrid(OpenMP & MPI) code. In addition, PAPI interface allows + us to access the information of build-in hardware counter.""" + + homepage = "https://github.com/avr-aics-riken/PMlib" + git = "https://github.com/avr-aics-riken/PMlib.git" + + version('master', branch='master') + version('6.4.1', commit='0a35f5bec8c12e532e5a1bdac8c32c659fd3ee11') + + variant('mpi', default=True, description='Activate MPI support') + variant('example', default=False, + description='This option turns on compiling sample codes.') + variant('fortran', default=False, + description='This option tells a compiler to use a Fortran.') + variant('openmp', default=False, description='Enable OpenMP directives') + variant('papi', default=False, description='Use PAPI library') + variant('otf', default=False, description='Use OTF library') + variant('precisetimer', default=True, + description='This option provides -DUSE_PRECISE_TIMER to C++' + + ' compiler option CMAKE_CXX_FLAGS when building' + + ' the PMlib library.') + + patch('fix_compiler_options.patch') + + depends_on('mpi', when='+mpi') + + def cmake_args(self): + spec = self.spec + args = [] + args.append('-DINSTALL_DIR={0}'.format(self.prefix)) + + if '+mpi' in spec: + args.append('-Dwith_MPI=yes') + else: + args.append('-Dwith_MPI=no') + + if '+example' in spec: + args.append('-Dwith_example=yes') + else: + args.append('-Dwith_example=no') + + if '+fortran' in spec: + args.append('-Denable_Fortran=yes') + else: + args.append('-Denable_Fortran=no') + + if '+openmp' in spec: + args.append('-Denable_OPENMP=yes') + else: + args.append('-Denable_OPENMP=no') + + if '+papi' in spec: + args.append('-Dwith_PAPI=yes') + else: + args.append('-Dwith_PAPI=no') + + if '+otf' in spec: + args.append('-Dwith_OTF=yes') + else: + args.append('-Dwith_OTF=no') + + if '+precisetimer' in spec: + args.append('-Denable_PreciseTimer=yes') + else: + args.append('-Denable_PreciseTimer=no') + + if '%gcc' in spec: + args.append('-DCMAKE_CXX_FLAGS=-fopenmp') + args.append('-DCMAKE_Fortran_FLAGS=-fopenmp -cpp') + + if '%fj' in spec: + args.append( + '-DCMAKE_TOOLCHAIN_FILE=./cmake/Toolchain_fx100.cmake') + + return args