Add ppOpen-APPL/FDM and ppOpen-APPL/FDM-AT. (#16116)

This commit is contained in:
Toyohisa Kameyama 2020-04-21 06:36:36 +09:00 committed by GitHub
parent 8e7f55e6d6
commit c6ef9c2b87
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 219 additions and 0 deletions

View File

@ -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)

View File

@ -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
!

View File

@ -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'))

View File

@ -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)

View File

@ -43,3 +43,9 @@ def install(self, spec, prefix):
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)