diff options
author | Toyohisa Kameyama <kameyama@riken.jp> | 2020-04-21 06:36:36 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-04-20 16:36:36 -0500 |
commit | c6ef9c2b87cefc26e2c4dc34c80e6ab951a011c4 (patch) | |
tree | 7a1f3e9c52707cab825df2973175b193c3268ccb /var | |
parent | 8e7f55e6d67a8f464fb543bb022add79562d05bf (diff) | |
download | spack-c6ef9c2b87cefc26e2c4dc34c80e6ab951a011c4.tar.gz spack-c6ef9c2b87cefc26e2c4dc34c80e6ab951a011c4.tar.bz2 spack-c6ef9c2b87cefc26e2c4dc34c80e6ab951a011c4.tar.xz spack-c6ef9c2b87cefc26e2c4dc34c80e6ab951a011c4.zip |
Add ppOpen-APPL/FDM and ppOpen-APPL/FDM-AT. (#16116)
Diffstat (limited to 'var')
5 files changed, 219 insertions, 0 deletions
diff --git a/var/spack/repos/builtin/packages/ppopen-appl-fdm-at/package.py b/var/spack/repos/builtin/packages/ppopen-appl-fdm-at/package.py new file mode 100755 index 0000000000..a8ab4fb9e8 --- /dev/null +++ b/var/spack/repos/builtin/packages/ppopen-appl-fdm-at/package.py @@ -0,0 +1,50 @@ +# Copyright 2013-2020 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 * +import os + + +class PpopenApplFdmAt(MakefilePackage): + """ppOpen-APPL/FDM with Auto-Tuning""" + + homepage = "http://ppopenhpc.cc.u-tokyo.ac.jp/ppopenhpc/" + url = "file://{0}/ppohFDM_AT_1.0.0.tar.gz".format(os.getcwd()) + + version('1.0.0', sha256='f6052b73250a41b2b319b27efc4d753c6ec1f67cd109b53099c2b240f7acd65a') + + depends_on('mpi') + # depends_on('ppopen-appl-fdm', type='build') + + build_directory = "3.hybrid_AT" + parallel = False + + def edit(self, spec, prefix): + with working_dir(self.build_directory): + fflags = ['-O3', self.compiler.openmp_flag] + if spec.satisfies('%gcc'): + fflags.append('-ffree-line-length-none') + if spec.satisfies('arch=x86_64:'): + fflags.append('-mcmodel=medium') + makefile_opt = FileFilter('Makefile.option') + makefile_opt.filter( + 'FC = .*$', + 'FC = {0}'.format(spec['mpi'].mpifc) + ) + makefile_opt.filter( + 'FFLAGS = .*$', + 'FFLAGS = -O3 {0}'.format(' '.join(fflags)) + ) + + def install(self, spec, prefix): + mkdir(prefix.bin) + copy(join_path(self.build_directory, 'seism3d3n'), prefix.bin) + install_src_dir = join_path(prefix.src, self.build_directory) + mkdirp(install_src_dir) + install_tree(self.build_directory, install_src_dir) + with working_dir(install_src_dir): + make('clean') + mkdir(prefix.doc) + copy('readme.txt', prefix.doc) diff --git a/var/spack/repos/builtin/packages/ppopen-appl-fdm/gfortran_iargc.patch b/var/spack/repos/builtin/packages/ppopen-appl-fdm/gfortran_iargc.patch new file mode 100755 index 0000000000..115a0f0688 --- /dev/null +++ b/var/spack/repos/builtin/packages/ppopen-appl-fdm/gfortran_iargc.patch @@ -0,0 +1,13 @@ +diff --git a/tools/seismic_3D-tools/m_stdio.f90 b/tools/seismic_3D-tools/m_stdio.f90 +index bddb715..bc00f68 100644 +--- a/tools/seismic_3D-tools/m_stdio.f90 ++++ b/tools/seismic_3D-tools/m_stdio.f90 +@@ -65,8 +65,6 @@ module stdio + real(PN), parameter :: DEG2RAD = PI/180._PN + real(PN), parameter :: RAD2DEG = 180.0_PN / PI + +- integer, external :: iargc +- + + interface readPrm + ! diff --git a/var/spack/repos/builtin/packages/ppopen-appl-fdm/package.py b/var/spack/repos/builtin/packages/ppopen-appl-fdm/package.py new file mode 100755 index 0000000000..450ae99efb --- /dev/null +++ b/var/spack/repos/builtin/packages/ppopen-appl-fdm/package.py @@ -0,0 +1,137 @@ +# Copyright 2013-2020 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) + +import os +from spack import * + + +class PpopenApplFdm(MakefilePackage): + """ + ppOpen-APPL/FDM is a application software for the FDM simulation of + seismic wave propagation in elastic media in 2D and 3D. + The 2D application is prepared for a single-CPU (sequential) calculation + and the 3D application use MPI and OpenMP for parallel computing. + """ + + homepage = "http://ppopenhpc.cc.u-tokyo.ac.jp/ppopenhpc/" + url = "file://{0}/ppohFDM_0.3.1.tar.gz".format(os.getcwd()) + + version('0.3.1', sha256='5db7c28ef2df43c0ffa28e542d92320fe3c8cd7551aabe1de64647191ddf7d0b') + + # remove unused variable definition + patch('unused.patch') + # remove iargc external definition + # iargc is intrinsic in gfortran + patch('gfortran_iargc.patch') + + depends_on('ppopen-math-vis', type='link') + depends_on('mpi') + + parallel = False + + def edit(self, spec, prefix): + makefile_in = FileFilter('Makefile.in') + makefile_in.filter('PREFIX += .*$', 'PREFIX = {0}'.format(prefix)) + makefile_in.filter( + 'LIBDIR = .*$', + 'LIBDIR = {0}'.format(prefix) + ) + makefile_in.filter( + 'CC += .*$', + 'CC = {0}'.format(spec['mpi'].mpicc) + ) + makefile_in.filter('COPTFLAGS += .*$', 'COPTFLAGS = -O3') + makefile_in.filter( + 'CXX += .*$', + 'CXX = {0}'.format(spec['mpi'].mpicxx) + ) + makefile_in.filter('CXXOPTFLAGS = .*$', 'CXXOPTFLAGS = -O3') + makefile_in.filter( + 'FC += .*$', + 'FC = {0}'.format(spec['mpi'].mpifc) + ) + makefile_in.filter('FOPTFLAGS += .*$', 'FOPTFLAGS = -O3') + makefile_in.filter( + 'F90 += .*$', + 'F90 = {0}'.format(spec['mpi'].mpifc) + ) + makefile_in.filter('F90OPTFLAGS += .*$', 'F90OPTFLAGS = -O3') + + makefile_opt = FileFilter(join_path( + 'src', 'seismic_2D', 'makefile.option') + ) + makefile_opt.filter('FC = .*$', 'FC = {0}'.format(spack_fc)) + makefile_opt.filter('FFLAGS = .*$', 'FFLAGS = -O3') + + makefile = FileFilter(join_path( + 'src', 'seismic_3D', '1.ppohFDM-ppohVIS', 'Makefile') + ) + makefile.filter('LIBS += .*$', 'LIBS = ') + makefile.filter( + 'FLDFLAGS += .*$', + 'FLDFLAGS = ' + spec['ppopen-math-vis'].libs.ld_flags + ) + + makefile_opt = FileFilter(join_path( + 'src', 'seismic_3D', '3.parallel', 'Makefile.option') + ) + makefile_opt.filter('FC = .*$', 'FC = {0}'.format(spec['mpi'].mpifc)) + makefile_opt.filter( + 'FFLAGS = .*$', + 'FFLAGS = -O3 {0}'.format(self.compiler.openmp_flag) + ) + + copy( + join_path('examples', 'seismic_3D-example', 'm_param.f90'), + join_path('src', 'seismic_3D', '1.ppohFDM-ppohVIS') + ) + copy( + join_path('examples', 'seismic_3D-example', 'm_param.f90'), + join_path('src', 'seismic_3D', '3.parallel') + ) + + for makefile in find('tools', 'makefile', recursive=True): + fflags = ['-O3', '-I.'] + m = FileFilter(makefile) + m.filter('^FC =.*$', 'FC = {0}'.format(spack_fc)) + m.filter( + '^FFLAGS =.*$', + 'FFLAGS = {0}'.format(' '.join(fflags)) + ) + + def build(self, spec, prefix): + make('seism2d', 'seism3d-ppohVIS', 'seism3d-parallel') + for d in ['seismic_2D-tools', 'seismic_3D-tools']: + with working_dir(join_path('tools', d)): + make('all') + + def install(self, spec, prefix): + commands = [ + join_path('src', 'seismic_2D', 'seism2d_psv'), + join_path('src', 'seismic_3D', '3.parallel', 'seism3d3n'), + join_path('src', 'seismic_3D', '1.ppohFDM-ppohVIS', 'seism3d3n'), + join_path('tools', 'seismic_2D-tools', 'pmxy2d'), + join_path('tools', 'seismic_2D-tools', 'rwav2d'), + join_path('tools', 'seismic_3D-tools', 'catsnap'), + join_path('tools', 'seismic_3D-tools', 'catwav'), + join_path('tools', 'seismic_3D-tools', 'ppmxy3d3'), + join_path('tools', 'seismic_3D-tools', 'rwav3d'), + ] + mkdir(prefix.bin) + for command in commands: + copy(command, prefix.bin) + install_tree('examples', prefix.examples) + install_tree('doc', prefix.doc) + install_tree('src', prefix.src) + copy('Makefile.in', prefix) + clean_dir = [ + join_path(prefix.src, 'seismic_2D'), + join_path(prefix.src, 'seismic_3D', '1.ppohFDM-ppohVIS'), + join_path(prefix.src, 'seismic_3D', '3.parallel'), + ] + for d in clean_dir: + with working_dir(d): + make('clean') + force_remove(join_path(prefix, 'Makefile.in')) diff --git a/var/spack/repos/builtin/packages/ppopen-appl-fdm/unused.patch b/var/spack/repos/builtin/packages/ppopen-appl-fdm/unused.patch new file mode 100755 index 0000000000..4c6e67c65d --- /dev/null +++ b/var/spack/repos/builtin/packages/ppopen-appl-fdm/unused.patch @@ -0,0 +1,13 @@ +diff --git a/tools/seismic_2D-tools/rwav2d.f90 b/tools/seismic_2D-tools/rwav2d.f90 +index ec08ea8..0f9543c 100644 +--- a/tools/seismic_2D-tools/rwav2d.f90 ++++ b/tools/seismic_2D-tools/rwav2d.f90 +@@ -41,7 +41,7 @@ program sort_seism2d_result + + integer :: station_num + integer :: ns, isx, isz +- integer :: i, k, ii, kk, j, IT ++ integer :: i, k, ii, kk, j + character(len=80) filename, filename2, tmp1 + integer :: istx(5000,100), istz(5000,100), stnum(5000,100) + real(PN) :: ntime(5000,100), vxall(5000,100), vzall(5000,100) diff --git a/var/spack/repos/builtin/packages/ppopen-math-vis/package.py b/var/spack/repos/builtin/packages/ppopen-math-vis/package.py index ad2ff3a7c8..0082783ed5 100644 --- a/var/spack/repos/builtin/packages/ppopen-math-vis/package.py +++ b/var/spack/repos/builtin/packages/ppopen-math-vis/package.py @@ -43,3 +43,9 @@ class PpopenMathVis(MakefilePackage): copy_tree('examples', join_path(prefix, 'examples')) mkdir(join_path(prefix, 'doc')) copy_tree('doc', join_path(prefix, 'doc')) + + @property + def libs(self): + return find_libraries( + ['libfppohvisfdm3d', 'libppohvisfdm3d'], + root=self.prefix, shared=False, recursive=True) |