mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-29 06:35:48 -04:00
Add OpenMP tests (also fix PEP8 compliance in test_compile.py).
This commit is contained in:
parent
7e5e146f4e
commit
d44dfd20d9
2 changed files with 66 additions and 22 deletions
|
|
@ -3,8 +3,8 @@
|
|||
"""Compilation tests
|
||||
|
||||
This set of tests makes sure that OpenMC can compile for many different
|
||||
combinations of compilation flags and options. By default, only the gfortran and
|
||||
ifort compilers are tested. This requires that the MPI, HDF5, and PETSC
|
||||
combinations of compilation flags and options. By default, only the gfortran
|
||||
and ifort compilers are tested. This requires that the MPI, HDF5, and PETSC
|
||||
libraries are already set up appropriately in the Makefile.
|
||||
|
||||
"""
|
||||
|
|
@ -15,80 +15,123 @@ import shutil
|
|||
|
||||
pwd = os.path.dirname(__file__)
|
||||
|
||||
if os.environ.has_key('COMPILER'):
|
||||
if 'COMPILER' in os.environ:
|
||||
compiler = 'COMPILER=' + os.environ['COMPILER']
|
||||
else:
|
||||
compiler = 'COMPILER=gnu'
|
||||
|
||||
|
||||
def setup():
|
||||
# Change to source directory
|
||||
os.chdir(pwd + '/../../src')
|
||||
|
||||
|
||||
def test_normal():
|
||||
returncode = run(['make','distclean'])
|
||||
returncode = run(['make', 'distclean'])
|
||||
returncode = run(['make', compiler])
|
||||
assert returncode == 0
|
||||
shutil.move('openmc', 'openmc-normal')
|
||||
|
||||
|
||||
def test_debug():
|
||||
returncode = run(['make','distclean'])
|
||||
returncode = run(['make', 'distclean'])
|
||||
returncode = run(['make', compiler, 'DEBUG=yes'])
|
||||
assert returncode == 0
|
||||
shutil.move('openmc', 'openmc-debug')
|
||||
|
||||
|
||||
def test_profile():
|
||||
returncode = run(['make','distclean'])
|
||||
returncode = run(['make', 'distclean'])
|
||||
returncode = run(['make', compiler, 'PROFILE=yes'])
|
||||
assert returncode == 0
|
||||
|
||||
|
||||
def test_optimize():
|
||||
returncode = run(['make','distclean'])
|
||||
returncode = run(['make', 'distclean'])
|
||||
returncode = run(['make', compiler, 'OPTIMIZE=yes'])
|
||||
assert returncode == 0
|
||||
shutil.move('openmc', 'openmc-optimize')
|
||||
|
||||
|
||||
def test_mpi():
|
||||
returncode = run(['make','distclean'])
|
||||
returncode = run(['make', 'distclean'])
|
||||
returncode = run(['make', compiler, 'MPI=yes'])
|
||||
assert returncode == 0
|
||||
shutil.move('openmc', 'openmc-mpi')
|
||||
|
||||
|
||||
def test_omp():
|
||||
returncode = run(['make', 'distclean'])
|
||||
returncode = run(['make', compiler, 'OPENMP=yes'])
|
||||
assert returncode == 0
|
||||
shutil.move('openmc', 'openmc-omp')
|
||||
|
||||
|
||||
def test_hdf5():
|
||||
returncode = run(['make','distclean'])
|
||||
returncode = run(['make', 'distclean'])
|
||||
returncode = run(['make', compiler, 'HDF5=yes'])
|
||||
assert returncode == 0
|
||||
shutil.move('openmc', 'openmc-hdf5')
|
||||
|
||||
|
||||
def test_petsc():
|
||||
returncode = run(['make','distclean'])
|
||||
returncode = run(['make', 'distclean'])
|
||||
returncode = run(['make', compiler, 'MPI=yes', 'PETSC=yes'])
|
||||
assert returncode == 0
|
||||
shutil.move('openmc', 'openmc-petsc')
|
||||
|
||||
|
||||
def test_mpi_omp():
|
||||
returncode = run(['make', 'distclean'])
|
||||
returncode = run(['make', compiler, 'MPI=yes', 'OPENMP=yes'])
|
||||
assert returncode == 0
|
||||
shutil.move('openmc', 'openmc-mpi-omp')
|
||||
|
||||
|
||||
def test_omp_hdf5():
|
||||
returncode = run(['make', 'distclean'])
|
||||
returncode = run(['make', compiler, 'MPI=yes', 'OPENMP=yes', 'HDF5=yes'])
|
||||
assert returncode == 0
|
||||
shutil.move('openmc', 'openmc-omp-hdf5')
|
||||
|
||||
|
||||
def test_mpi_hdf5():
|
||||
returncode = run(['make','distclean'])
|
||||
returncode = run(['make', 'distclean'])
|
||||
returncode = run(['make', compiler, 'MPI=yes', 'HDF5=yes'])
|
||||
assert returncode == 0
|
||||
shutil.move('openmc', 'openmc-phdf5')
|
||||
|
||||
|
||||
def test_mpi_hdf5_petsc():
|
||||
returncode = run(['make','distclean'])
|
||||
returncode = run(['make', 'distclean'])
|
||||
returncode = run(['make', compiler, 'MPI=yes', 'HDF5=yes', 'PETSC=yes'])
|
||||
assert returncode == 0
|
||||
shutil.move('openmc', 'openmc-phdf5-petsc')
|
||||
|
||||
|
||||
def test_mpi_hdf5_petsc_optimize():
|
||||
returncode = run(['make','distclean'])
|
||||
returncode = run(['make', compiler, 'MPI=yes', 'HDF5=yes', 'PETSC=yes', 'OPTIMIZE=yes'])
|
||||
returncode = run(['make', 'distclean'])
|
||||
returncode = run(['make', compiler, 'MPI=yes', 'HDF5=yes', 'PETSC=yes',
|
||||
'OPTIMIZE=yes'])
|
||||
assert returncode == 0
|
||||
shutil.move('openmc', 'openmc-phdf5-petsc-optimize')
|
||||
|
||||
|
||||
def test_mpi_omp_hdf5_petsc_optimize():
|
||||
returncode = run(['make', 'distclean'])
|
||||
returncode = run(['make', compiler, 'MPI=yes', 'OMP=yes', 'HDF5=yes',
|
||||
'PETSC=yes', 'OPTIMIZE=yes'])
|
||||
assert returncode == 0
|
||||
shutil.move('openmc', 'openmc-omp-phdf5-petsc-optimize')
|
||||
|
||||
|
||||
def run(commands):
|
||||
proc = Popen(commands, stderr=STDOUT, stdout=PIPE)
|
||||
returncode = proc.wait()
|
||||
print(proc.communicate()[0])
|
||||
return returncode
|
||||
|
||||
|
||||
def teardown(commands):
|
||||
returncode = run(['make','distclean'])
|
||||
shutil.copy('openmc-normal','openmc')
|
||||
returncode = run(['make', 'distclean'])
|
||||
shutil.copy('openmc-normal', 'openmc')
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue