add autodock,cmake,gaussian,gromacs

This commit is contained in:
2023-10-09 02:35:22 +08:00
parent 638106fdff
commit 8cf6546b26
4 changed files with 393 additions and 33 deletions

View File

@@ -16,39 +16,45 @@ class command(sunhpc.commands.soft.command):
class Command(command): class Command(command):
""" """
Build the Gaussian software. Build the AutoDock software.
<arg type="string" name="version"> <arg type="string" name="version">
Specifies the software version. e.g,, version=03/09/16 Specifies the software version. e.g,, version=4.2.6
</arg> </arg>
<param type="path" name="prefix"> <param type="path" name="prefix">
Specifies the software install path. Specifies the software install path.
Default: /share/apps/soft/autodock
</param> </param>
<param type="path" name="envs"> <param type="path" name="envs">
Specifies the software env path. Specifies the software env path.
Default: /share/apps/envs
</param> </param>
<param type="path" name="source"> <param type="path" name="source">
Specifies the software source path. e.g,, /mnt/usb Specifies the software source path. e.g,, /mnt/usb
Default: /mnt/usb
</param> </param>
<example cmd='soft gaussian prefix=/share/apps/soft version=16'> <example cmd='soft autodock prefix=/share/apps/soft version=4.2.6'>
install the gaussian software. install the autodock software.
</example> </example>
""" """
def run(self, params, args): def run(self, params, args):
(prefix, version, source, envs) = self.fillParams([ (prefix, version, source, envs) = self.fillParams([
('prefix', '/share/apps/soft'), ('prefix', '/share/apps/soft/autodock'),
('version', None), ('version', None),
('source', '/mnt/usb'), ('source', '/mnt/usb'),
('envs', '/share/apps/envs'), ('envs', '/share/apps/envs'),
]) ])
if len(args):
version = args[0]
if not version: if not version:
self.msg('must supply an "Gaussian version" e.g,, version=03/09/16', 'a') self.msg('must supply an "AutoDock version" e.g,, version=4.2.6', 'a')
try: try:
os.makedirs(prefix) os.makedirs(prefix)
@@ -59,37 +65,43 @@ class Command(command):
if not os.path.exists(envs): if not os.path.exists(envs):
os.makedirs(envs) os.makedirs(envs)
softname = 'Gaussian%s' % version if version == '4.2.6':
basename = 'autodock-4.2.6'
softdirs = os.path.join(source, 'hpcsoft')
softlist = os.listdir(softdirs)
if 'Gaussian' not in softlist:
self.msg('The "%s" software was not found in the %s directory.' % (softname, softdirs), 'a')
gspathname = os.path.join(softdirs, 'Gaussian', softname, 'Gaussian16-a03.tbz')
gaussian = os.path.join(prefix, 'g%s' % version)
if os.path.exists(gaussian):
self.msg('The %s already exists,to reinstall it, remove it first.' % gaussian)
else: else:
self.msg('Start installing the %s software to the %s directory...' % (softname, prefix)) self.msg('Version error, Try use version number "4.2.6"', 'a')
os.system('tar -xf %s -C %s' % (gspathname, prefix))
gsenv = os.path.join(envs, 'g16-env.sh') filename = '%s.tar.bz2' % basename
softname = os.path.join(source, 'hpcsoft/AutoDock', filename)
if not os.path.exists(softname):
self.msg('The "%s" not found.' % softname, 'a')
destname = os.path.join(prefix, basename)
softlist = os.listdir(prefix)
if basename in softlist:
self.msg('The %s already exists,to reinstall it, remove it first.' % basename, 'w')
else:
self.msg('Start installing the %s software to the %s directory...' % (basename, prefix))
os.system('tar -xf %s -C %s' % (softname, prefix))
gsenv = os.path.join(envs, '%s-env.sh' % basename)
with open(gsenv, 'w') as f: with open(gsenv, 'w') as f:
f.write('#!/bin/sh\n') f.write('#!/bin/sh\n')
f.write('#\n# %s env config\n#\n\n' % gaussian) f.write('#\n# %s env config\n#\n\n' % basename)
f.write('export g%sroot=%s\n' % (version, prefix)) f.write('export PATH=%s/%s:$PATH\n' % (prefix, basename))
f.write('source $g%sroot/g%s/bsd/g%s.profile\n\n' % (version, version, version))
f.write('export GAUSS_SCDIR=~/gstmp\n')
# create shared user and group. # create shared user and group.
self.msg('Create a shared group to run the %s software.' % softname) self.msg('')
self.msg('--------------------------------------------------------')
self.msg('Create a shared group to run the %s software.' % basename)
self.msg(' 1, groupadd -g 888 public ') self.msg(' 1, groupadd -g 888 public ')
self.msg(' 2, usermod -G public dell ') self.msg(' 2, usermod -G public dell ')
self.msg(' 3, chown -R root:public %s/g%s' % (prefix, version)) self.msg(' 3, chown -R root:public %s/%s' % (prefix, basename))
self.msg('--------------------------------------------------------')
self.msg('')
self.msg(' source %s' % gsenv)
self.msg('--------------------------------------------------------')

View File

@@ -0,0 +1,137 @@
#
#coding:utf-8
#
#Author : QCSun
#Email : qcsun@sunhpc.com
#Times : 2023-04-14 05:21:02
#WebSite : https://www.sunhpc.com
import os
import sys
import sunhpc
import shutil
class command(sunhpc.commands.soft.command):
pass
class Command(command):
"""
Build the Cmake software.
<arg type="string" name="version">
Specifies the software version. e.g,, version=3.26.4
</arg>
<param type="path" name="prefix">
Specifies the software install path.
Default: /share/apps/soft/cmake
</param>
<param type="path" name="envs">
Specifies the software env path.
Default: /share/apps/envs
</param>
<param type="path" name="source">
Specifies the software source path. e.g,, /mnt/usb
Default: /mnt/usb
</param>
<example cmd='soft cmake prefix=/share/apps/soft version=3.26.4'>
install the cmake software.
</example>
"""
def run(self, params, args):
(prefix, version, source, envs) = self.fillParams([
('prefix', '/share/apps/soft/cmake'),
('version', '3.26.4'),
('source', '/mnt/usb'),
('envs', '/share/apps/envs'),
])
if len(args):
version = args[0]
if not version:
self.msg('must supply an "Cmake version" e.g,, version=3.26.4', 'a')
try:
os.makedirs(prefix)
self.msg("The %s directory does not exist,and it will be created." % prefix, 'w')
except FileExistsError:
pass
if not os.path.exists(envs):
os.makedirs(envs)
if version == '3.26.4':
basename = 'cmake-%s-linux-x86_64' % version
else:
self.msg('Version error, Try use version number "3.26.4"', 'a')
filename = '%s.sh' % basename
softname = os.path.join(source, 'hpcsoft/Cmake', filename)
if not os.path.exists(softname):
self.msg('The "%s" not found.' % softname, 'a')
destname = os.path.join(prefix, version)
if not os.path.exists(destname):
os.makedirs(destname)
makename = os.path.join(prefix, version, 'bin', 'cmake')
if os.path.exists(makename):
self.msg('The "cmake" already exists,to reinstall it, remove it first.', 'w')
else:
self.msg('Start installing the cmake software to the %s directory...' % (destname))
# ./cmake-3.26.4-linux-x86_64.sh --prefix=/share/apps/soft/cmake --skip-license
cmd = 'sh %s --prefix=%s --skip-license' % (softname, destname)
print ('cmd---->', cmd)
os.system('sh %s --prefix=%s --skip-license' % (softname, destname))
gsenv = os.path.join(envs, 'cmake-%s-env.sh' % version)
with open(gsenv, 'w') as f:
f.write('#!/bin/sh\n')
f.write('#\n# %s env config\n#\n\n' % basename)
f.write('export PATH=%s/bin:$PATH\n' % destname)
# create shared user and group.
self.msg('')
self.msg('--------------------------------------------------------')
self.msg('Create a shared group to run the %s software.' % basename)
self.msg(' 1, groupadd -g 888 public ')
self.msg(' 2, usermod -G public dell ')
self.msg(' 3, chown -R root:public %s' % prefix)
self.msg('--------------------------------------------------------')
self.msg('')
self.msg(' source %s' % gsenv)
self.msg('--------------------------------------------------------')

View File

@@ -99,8 +99,6 @@ class Command(command):
softlist = os.listdir(prefix) softlist = os.listdir(prefix)
print ('------softlist-----', softlist)
print ('------basename-----', basename)
if basename in softlist: if basename in softlist:
self.msg('The %s already exists,to reinstall it, remove it first.' % gaussian) self.msg('The %s already exists,to reinstall it, remove it first.' % gaussian)
else: else:
@@ -111,17 +109,21 @@ class Command(command):
with open(gsenv, 'w') as f: with open(gsenv, 'w') as f:
f.write('#!/bin/sh\n') f.write('#!/bin/sh\n')
f.write('#\n# %s env config\n#\n\n' % gaussian) f.write('#\n# %s env config\n#\n\n' % gaussian)
f.write('export g%sroot=%s\n' % (version, prefix)) f.write('export g%sroot=%s/%s\n' % (version, prefix, basename))
f.write('source $g%sroot/g%s/bsd/g%s.profile\n\n' % (version, version, version)) f.write('source $g%sroot/g%s/bsd/g%s.profile\n\n' % (version, version, version))
f.write('export GAUSS_SCDIR=~/gstmp\n') f.write('export GAUSS_SCDIR=~/gstmp\n')
# create shared user and group. # create shared user and group.
self.msg('Create a shared group to run the %s software.' % softname) self.msg('')
self.msg('--------------------------------------------------------')
self.msg('Create a shared group to run the %s software.' % basename)
self.msg(' 1, groupadd -g 888 public ') self.msg(' 1, groupadd -g 888 public ')
self.msg(' 2, usermod -G public dell ') self.msg(' 2, usermod -G public dell ')
self.msg(' 3, chown -R root:public %s/%s' % (prefix, basename)) self.msg(' 3, chown -R root:public %s/%s' % (prefix, basename))
self.msg('--------------------------------------------------------')
self.msg('') self.msg('')
self.msg(' source %s' % gsenv) self.msg(' source %s' % gsenv)
self.msg('--------------------------------------------------------')

View File

@@ -0,0 +1,209 @@
#
#coding:utf-8
#
#Author : QCSun
#Email : qcsun@sunhpc.com
#Times : 2023-04-14 05:21:02
#WebSite : https://www.sunhpc.com
import os
import sys
import sunhpc
import shutil
class command(sunhpc.commands.soft.command):
pass
class Command(command):
"""
Build the Gromacs software.
<arg type="string" name="version">
Specifies the software version. e.g,, version=2022.6
</arg>
<param type="path" name="prefix">
Specifies the software install path.
Default: /share/apps/soft/gromacs
</param>
<param type="path" name="envs">
Specifies the software env path.
Default: /share/apps/envs
</param>
<param type="path" name="source">
Specifies the software source path. e.g,, /mnt/usb
Default: /mnt/usb
</param>
<param type="Bool" name="mpi">
Enable mpi. Default: No
</param>
<param type="Bool" name="cuda">
Enable cuda. Default: No
</param>
<example cmd='soft gromacs prefix=/share/apps/soft/gromacs version=2022.6'>
install the gromacs software.
</example>
"""
def run(self, params, args):
(prefix, version, source, envs, mpistatus, cudastatus) = self.fillParams([
('prefix', '/share/apps/soft/gromacs'),
('version', None),
('source', '/mnt/usb'),
('envs', '/share/apps/envs'),
('mpi', None),
('cuda', None),
])
if len(args):
version = args[0]
if not version:
self.msg('must supply an "Gromacs version" e.g,, version=2022.6, 2023, 2023.2', 'a')
try:
os.makedirs(prefix)
self.msg("The %s directory does not exist,and it will be created." % prefix, 'w')
except FileExistsError:
pass
if not os.path.exists(envs):
os.makedirs(envs)
basename = 'gromacs-%s' % version
filename = '%s.tar.gz' % basename
softname = os.path.join(source, 'hpcsoft/Gromacs', filename)
if not os.path.exists(softname):
self.msg('The "%s" not found.' % softname, 'a')
destname = os.path.join(prefix, version)
self.msg('Start decompress the %s software to the /tmp directory...' % basename)
tmpdir = os.path.join(os.sep, 'tmp', basename)
#if os.path.exists(tmpdir):
# os.system('rm -rf /tmp/%s' % basename)
#os.system('tar -xf %s -C /tmp' % softname)
# chdir to /tmp/gromacs-version
os.chdir(tmpdir)
cwd = os.getcwd()
cmake = shutil.which('cmake')
try:
os.makedirs('build/src/external/build-fftw/fftwBuild-prefix/src')
except FileExistsError:
pass
# copy fftw to src dirs
srcfile = os.path.join(source, 'hpcsoft', 'fftw', 'fftw-3.3.8.tar.gz')
dstfile = 'build/src/external/build-fftw/fftwBuild-prefix/src/fftw-3.3.8.tar.gz'
shutil.copyfile(srcfile, dstfile)
regname = 'regressiontests-%s' % version
regfile = os.path.join(source, 'hpcsoft', 'Gromacs', '%s.tar.gz' % regname)
regpath = os.path.join(tmpdir, 'build', regname)
if os.path.exists(regpath):
shutil.rmtree(regpath)
os.system('tar -xf %s -C build/' % regfile)
os.chdir('build')
self.build_serial(destname, regname)
if mpistatus:
mpirun = shutil.which('mpirun')
if not mpirun:
self.msg('mpirun command not found.please install an mpirun software.', 'a')
self.build_mpirun(destname, regname)
if cudastatus:
if not cudapath:
self.msg('must supply an CUDA Path. e.g,, cuda=/usr/local/cuda', 'a')
self.build_nvidia(destname, regname, cudapath)
gsenv = os.path.join(envs, '%s-env.sh' % basename)
with open(gsenv, 'w') as f:
f.write('#!/bin/sh\n')
f.write('#\n# %s env config\n#\n\n' % basename)
f.write('source %s/bin/GMXRC\n' % destname)
# create shared user and group.
self.msg('')
self.msg('--------------------------------------------------------')
self.msg('Create a shared group to run the %s software.' % basename)
self.msg(' 1, groupadd -g 888 public ')
self.msg(' 2, usermod -G public dell ')
self.msg(' 3, chown -R root:public %s' % destname))
self.msg('--------------------------------------------------------')
self.msg('')
self.msg(' source %s' % gsenv)
self.msg('--------------------------------------------------------')
os.system('source %s' % gsenv)
os.system('gmx -version')
def build_serial(self, destname, regname):
query = 'cmake .. -DCMAKE_INSTALL_PREFIX=%s ' % destname
query += '-DGMX_BUILD_OWN_FFTW=ON '
query += '-DREGRESSIONTEST_PATH=%s' % regname
os.system(query)
os.system('make && make check && make install')
def build_mpirun(self, destname, regname):
query = 'cmake .. -DCMAKE_INSTALL_PREFIX=%s ' % destname
query += '-DGMX_BUILD_OWN_FFTW=ON '
query += '-DGMX_MPI=ON '
query += '-DREGRESSIONTEST_PATH=%s' % regname
os.system(query)
os.system('make && make check && make install')
def build_nvidia(self, destname, regname, cudapath):
query = 'cmake .. -DCMAKE_INSTALL_PREFIX=%s ' % destname
query += '-DGMX_BUILD_OWN_FFTW=ON '
query += '-DGMX_GPU=CUDA ' # NVIDIA CUDA support enabled
query += '-DCUDA_TOOLKIT_ROOT_DIR=%s' % cudapath
#query += '-DGMX_GPU=OpenCL ' # OpenCL support enabled
#query += '-DGMX_GPU=SYCL ' # using Intel oneAPI DPC++ by default.
#query += '-DGMX_SYCL_HIPSYCL=ON '
#query += '-DGMX_DOUBLE=on '
#query += '-DGMX_SIMD=xxx ' # specify the level of SIMD support
#query += '-DBUILD_SHARED_LIBS=off '
query += '-DREGRESSIONTEST_PATH=%s' % regname
os.system(query)
os.system('make && make check && make install')