mirror of
https://github.com/NGSolve/netgen.git
synced 2025-01-12 14:10:34 +05:00
mpi4py test
This commit is contained in:
parent
eb75bc31a6
commit
2290d9fe72
@ -1,5 +1,6 @@
|
|||||||
FROM ubuntu:18.04
|
FROM ubuntu:18.04
|
||||||
ENV DEBIAN_FRONTEND=noninteractive
|
ENV DEBIAN_FRONTEND=noninteractive
|
||||||
MAINTAINER Matthias Hochsteger <matthias.hochsteger@tuwien.ac.at>
|
MAINTAINER Matthias Hochsteger <matthias.hochsteger@tuwien.ac.at>
|
||||||
RUN apt-get update && apt-get -y install python3 libpython3-dev libxmu-dev tk-dev tcl-dev cmake git g++ libglu1-mesa-dev ccache python3-pytest python3-numpy python3-tk python3-mpi4py clang-tidy python3-distutils clang libopenmpi-dev openmpi-bin gfortran
|
RUN apt-get update && apt-get -y install python3 libpython3-dev python3-pip libxmu-dev tk-dev tcl-dev cmake git g++ libglu1-mesa-dev ccache python3-pytest python3-numpy python3-tk python3-mpi4py clang-tidy python3-distutils clang libopenmpi-dev openmpi-bin gfortran
|
||||||
|
RUN python3 -m pip install pytest-mpi
|
||||||
ADD . /root/src/netgen
|
ADD . /root/src/netgen
|
||||||
|
@ -2,4 +2,7 @@ if(USE_PYTHON)
|
|||||||
add_test(NAME pytest COMMAND ${PYTHON_EXECUTABLE} -m pytest WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
|
add_test(NAME pytest COMMAND ${PYTHON_EXECUTABLE} -m pytest WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
|
||||||
add_custom_target(pytest ${PYTHON_EXECUTABLE} -m pytest WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
|
add_custom_target(pytest ${PYTHON_EXECUTABLE} -m pytest WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
|
||||||
set_tests_properties ( pytest PROPERTIES TIMEOUT 1800 )
|
set_tests_properties ( pytest PROPERTIES TIMEOUT 1800 )
|
||||||
|
if(USE_MPI AND USE_MPI4PY)
|
||||||
|
add_test(NAME pytest-mpi COMMAND ${MPIEXEC_EXECUTABLE} --allow-run-as-root -np 4 ${PYTHON_EXECUTABLE} -m pytest --with-mpi test_mpi4py.py WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
|
||||||
|
endif(USE_MPI AND USE_MPI4PY)
|
||||||
endif(USE_PYTHON)
|
endif(USE_PYTHON)
|
||||||
|
21
tests/pytest/test_mpi4py.py
Normal file
21
tests/pytest/test_mpi4py.py
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
import pytest
|
||||||
|
import netgen.meshing
|
||||||
|
|
||||||
|
mpi4py = pytest.importorskip("mpi4py")
|
||||||
|
|
||||||
|
@pytest.mark.mpi
|
||||||
|
def test_mpi4py():
|
||||||
|
comm = mpi4py.MPI.COMM_WORLD
|
||||||
|
|
||||||
|
if comm.rank==0:
|
||||||
|
from netgen.csg import unit_cube
|
||||||
|
m = unit_cube.GenerateMesh(maxh=0.1)
|
||||||
|
m.Save("mpimesh")
|
||||||
|
|
||||||
|
comm.Barrier()
|
||||||
|
|
||||||
|
mesh = netgen.meshing.Mesh(3, comm)
|
||||||
|
mesh.Load("mpimesh.vol.gz")
|
||||||
|
|
||||||
|
if comm.rank==0:
|
||||||
|
assert mesh.ne==0
|
Loading…
Reference in New Issue
Block a user