swan移植指南

原文地址swan

修改platform.pl

修改第406行

1
print OUTFILE "F90_MPI = mpifort\n";

修改第414行

1
print OUTFILE "NETCDFROOT =/path/to/NETCDF\n";

将第788行修改为$compiler = "gfortran",或在环境变量中导入FC=gfortran

1
2
3
4
5
6
7
8
9
10
11
12
13
14
sub getcmpl {

my $compiler = $ENV{'FC'};

unless ( $compiler ) {
foreach ('ifort','gfortran','f90','ifc','efc','pgf90','xlf90', 'lf95','g95') {
$compiler = "gfortran";
my $path = `which $compiler`;
last if $path;
}
}

return $compiler;
}

编译安装

执行make config生成配置文件,然后执行make mpi编译程序

1
2
make config
make mpi

spack安装代码

package.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
from spack import *
from os import *

class Swan(MakefilePackage):
"""FIXME: Put a proper description of your package here."""

# FIXME: Add a proper url for your package's homepage here.
homepage = "https://blog.lhxone.com"
url = "file:///es01/yeesuan/yeesuan003/source/swan4131.tar.gz"

# FIXME: Add a list of GitHub accounts to

version('4131', sha256='cd3ba1f0d79123f1b7d42a43169f07575b59b01e604c5e66fbc09769e227432e')

# FIXME: Add dependencies if required.
# depends_on('intel-parallel-studio', type = ('build', 'run'))
depends_on('mpich', type = 'build')
depends_on('netcdf-fortran', type = ('build', 'run'))
depends_on('libfabric', type = ('run'))

def edit(self, spec, prefix):
env['FC'] = 'gfortran'
makefile = FileFilter('platform.pl')
makefile.filter('F90_MPI = .*', 'F90_MPI = mpifort\\n";')
makefile.filter('NETCDFROOT =', 'NETCDFROOT = /es01/yeesuan/yeesuan003/NETCDF')

def build(self, spec, prefix):
make('config')
make('mpi')


def install(self, spec, prefix):
mkdir(prefix.bin)
install('*.exe', prefix.bin)