diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 8b999421c87273e3a7ca4c68a20b792acabcc101..358c7fe8cae37792215d2fe541c08645620faadc 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -24,7 +24,6 @@ Python 3.5 K40: - nvidia-k40 except: - tags - - distributed-fmm-global Python 2.7 POCL: script: @@ -38,7 +37,6 @@ Python 2.7 POCL: - pocl except: - tags - - distributed-fmm-global Python 3.5 POCL: script: @@ -52,7 +50,6 @@ Python 3.5 POCL: - pocl except: - tags - - distributed-fmm-global Python 3.6 POCL: script: @@ -66,7 +63,20 @@ Python 3.6 POCL: - pocl except: - tags - - distributed-fmm-global + +Python 3.6 POCL MPI: + script: + - export PY_EXE=python3.6 + - export PYOPENCL_TEST=portable + - export EXTRA_INSTALL="numpy mako mpi4py" + - export PYTEST_ADDOPTS="-k mpi --capture=no" + - curl -L -O -k https://gitlab.tiker.net/inducer/ci-support/raw/master/build-and-test-py-project.sh + - ". ./build-and-test-py-project.sh" + tags: + - python3.6 + - pocl + except: + - tags Documentation: script: diff --git a/setup.py b/setup.py index 32cca6a23d46884c398fe0f31c363f7e8f4e7c76..9b424e191ead0357b59a0382926e832c8e073a9c 100644 --- a/setup.py +++ b/setup.py @@ -3,7 +3,7 @@ def main(): - from setuptools import setup + from setuptools import setup, find_packages version_dict = {} init_filename = "boxtree/version.py" @@ -39,7 +39,7 @@ def main(): 'Topic :: Utilities', ], - packages=["boxtree"], + packages=find_packages(), install_requires=[ "pytools>=2018.4", "pyopencl>=2013.1", @@ -47,7 +47,12 @@ def main(): "pytest>=2.3", "cgen>=2013.1.2", "six", - ]) + ], + package_data={ + "boxtree": [ + "distributed/default_perf_model.json" + ] + }) if __name__ == '__main__': diff --git a/test/test_distributed.py b/test/test_distributed.py index 42ca946d31d838804a4cceb995ba561d8b710247..c4a22107db94ccbf2fbb1796f5f05bfc68c604ff 100644 --- a/test/test_distributed.py +++ b/test/test_distributed.py @@ -1,8 +1,5 @@ import numpy as np import pyopencl as cl -from mpi4py import MPI -from boxtree.distributed.calculation import DistributedFMMLibExpansionWrangler -from boxtree.distributed import DistributedFMMInfo import numpy.linalg as la from boxtree.pyfmmlib_integration import FMMLibExpansionWrangler from boxtree.tools import ConstantOneExpansionWrangler as \ @@ -17,6 +14,7 @@ logging.getLogger("boxtree.distributed").setLevel(logging.INFO) def _test_against_shared(dims, nsources, ntargets, dtype): + from mpi4py import MPI # Get the current rank comm = MPI.COMM_WORLD @@ -73,9 +71,13 @@ def _test_against_shared(dims, nsources, ntargets, dtype): # Compute FMM using distributed memory parallelism def distributed_expansion_wrangler_factory(tree): + from boxtree.distributed.calculation import \ + DistributedFMMLibExpansionWrangler + return DistributedFMMLibExpansionWrangler( queue, tree, helmholtz_k, fmm_level_to_nterms=fmm_level_to_nterms) + from boxtree.distributed import DistributedFMMInfo distribued_fmm_info = DistributedFMMInfo( queue, trav, distributed_expansion_wrangler_factory, comm=comm) pot_dfmm = distribued_fmm_info.drive_dfmm(sources_weights) @@ -99,13 +101,15 @@ def test_against_shared(num_processes, dims, nsources, ntargets): newenv["dims"] = str(dims) newenv["nsources"] = str(nsources) newenv["ntargets"] = str(ntargets) + newenv["OMP_NUM_THREADS"] = "1" import subprocess import sys subprocess.run([ "mpiexec", "-np", str(num_processes), "-x", "PYTEST", "-x", "dims", "-x", "nsources", "-x", "ntargets", - sys.executable, __file__], + # https://mpi4py.readthedocs.io/en/stable/mpi4py.run.html + sys.executable, "-m", "mpi4py.run", __file__], env=newenv, check=True ) @@ -123,6 +127,7 @@ class ConstantOneExpansionWrangler(ConstantOneExpansionWranglerBase): def _test_constantone(dims, nsources, ntargets, dtype): + from mpi4py import MPI # Get the current rank comm = MPI.COMM_WORLD @@ -136,7 +141,6 @@ def _test_constantone(dims, nsources, ntargets, dtype): import pyopencl as cl ctx = cl.create_some_context() queue = cl.CommandQueue(ctx) - print(queue.context.devices) if rank == 0: @@ -189,13 +193,15 @@ def test_constantone(num_processes, dims, nsources, ntargets): newenv["dims"] = str(dims) newenv["nsources"] = str(nsources) newenv["ntargets"] = str(ntargets) + newenv["OMP_NUM_THREADS"] = "1" import subprocess import sys subprocess.run([ "mpiexec", "-np", str(num_processes), "-x", "PYTEST", "-x", "dims", "-x", "nsources", "-x", "ntargets", - sys.executable, __file__], + # https://mpi4py.readthedocs.io/en/stable/mpi4py.run.html + sys.executable, "-m", "mpi4py.run", __file__], env=newenv, check=True )