summaryrefslogtreecommitdiffstats
path: root/lib/sunhpc/commands/soft/gromacs/__init__.py
diff options
context:
space:
mode:
Diffstat (limited to 'lib/sunhpc/commands/soft/gromacs/__init__.py')
-rw-r--r--lib/sunhpc/commands/soft/gromacs/__init__.py64
1 files changed, 23 insertions, 41 deletions
diff --git a/lib/sunhpc/commands/soft/gromacs/__init__.py b/lib/sunhpc/commands/soft/gromacs/__init__.py
index 1029ef1..8c7c60e 100644
--- a/lib/sunhpc/commands/soft/gromacs/__init__.py
+++ b/lib/sunhpc/commands/soft/gromacs/__init__.py
@@ -31,18 +31,12 @@ class Command(command):
Specifies the software install path. Default: /share/apps/soft
</param>
- <param type="path" name="envs">
- Specifies the environment variable storage path. Default: /share/apps/envs
+ <param type="path" name="cuda">
+ Specifies the cuda path. Default: /usr/local/cuda
</param>
- <param type="Bool" name="serial">
- Enable serial. Default: yes
- </param>
- <param type="Bool" name="mpi">
- Enable MPI. Default: yes
- </param>
- <param type="Bool" name="gpu">
- Enable GPU. Default: yes
+ <param type="path" name="envs">
+ Specifies the environment variable storage path. Default: /share/apps/envs
</param>
<example cmd='soft mpi prefix=/share/apps/soft/xxx version=x.x.x'>
@@ -51,15 +45,12 @@ class Command(command):
"""
def run(self, params, args):
- (prefix, cudapath, envs, source, version, serial, mpi, gpu) = self.fillParams([
+ (prefix, cudapath, envs, source, version) = self.fillParams([
('prefix', '/share/apps/soft'),
('cudapath', '/usr/local/cuda'),
('envs', '/share/apps/envs'),
('source', '/mnt/usb'),
('version', None),
- ('serial', False),
- ('mpi', False),
- ('gpu', False),
])
softname = 'gromacs'
@@ -75,10 +66,16 @@ class Command(command):
self.create_dirs(prefix, source, envs, version, softname, suffname, dirsname)
- self.build(serial, mpi, gpu, cudapath, envs)
- #self.clean()
+ # Execute compilation
+ self.build(cudapath, envs)
- def build(self, serial, mpi, gpu, cudapath, envs):
+ # configure envs
+ self.writeEnvs()
+
+ # Cleanup compile cache files
+ self.clean()
+
+ def build(self, cudapath, envs):
"""Start build the software."""
self.cwd = os.getcwd()
@@ -90,24 +87,12 @@ class Command(command):
build_dirs = os.path.join(self.tmpdirs, self.basename)
os.chdir(build_dirs)
- if serial:
- self.build_serial()
-
- if mpi:
- self.build_mpi(envs)
-
-
- # configure envs
- self.writeEnvs()
-
- def build_mpi(self, envs):
- self.msg('Starting compile MPI version gromacs...')
-
+ self.msg('Starting compiling gromacs software ...')
ask_yn = ''
while not ask_yn:
txt = 'The MPI must be loaded before installing the Groamcs mpi version?\n'
txt += '\te.g,, source %s/mpich-xxx, openmpi-xxx' % envs
- ask_yn = input('%s: ' % self.message(txt, tag='[+]', end='[n/y]'))
+ ask_yn = input('%s: ' % self.message(txt, tag='[+]', end='[no/yes/skip]'))
if ask_yn in ['n', 'no']:
sys.exit(0)
@@ -115,18 +100,15 @@ class Command(command):
cmd = 'cmake .. -DCMAKE_INSTALL_PREFIX=%s ' % self.prefix
cmd += '-DGMX_BUILD_OWN_FFTW=ON '
- cmd += '-DGMX_MPI=ON '
- cmd += '-DREGRESSIONTEST_PATH=%s' % self.regress
- os.system(cmd)
- os.system('make && make check && make install')
- self.clean()
+ if ask_yn in ['y', 'yes']:
+ cmd += '-DGMX_MPI=ON '
- def build_serial(self):
- self.msg('Starting compile serial version gromacs...')
- self.preceding()
+ if os.path.exists(cudapath):
+ cmd += '-DGMX_GPU=CUDA '
+ cmd += '-DCUDA_TOOLKIT_ROOT_DIR=%s ' % cudapath
+
+ # 安装双精度版,加上-DGMX_DOUBLE=ON,不过此时不兼容GPU加速
- cmd = 'cmake .. -DCMAKE_INSTALL_PREFIX=%s ' % self.prefix
- cmd += '-DGMX_BUILD_OWN_FFTW=ON '
cmd += '-DREGRESSIONTEST_PATH=%s' % self.regress
os.system(cmd)
os.system('make && make check && make install')