Skip to content

Commit

Permalink
Merge branch 'master' into enable-conversion-warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
joaander committed Dec 16, 2020
2 parents d7c66b1 + b69175c commit 5f0f657
Show file tree
Hide file tree
Showing 11 changed files with 668 additions and 660 deletions.
12 changes: 11 additions & 1 deletion CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,17 @@ v3.0.0-beta.3 (not yet released)

*Added*

- ``ParticleFilters`` are picklable.
- ``hoomd.variant.Variant`` objects are picklable.
- ``hoomd.filter.ParticleFilter`` objects are picklable.
- ``hoomd.trigger.Trigger`` objects are picklable.

*Changed*

- Improved compilation docs.

*Fixed*

- ``hoomd.variant.Power`` objects now have a ``t_ramp`` attribute as documented.

v3.0.0-beta.2 (2020-12-15)
^^^^^^^^^^^^^^^^^^^^^^^^^^
Expand Down
148 changes: 63 additions & 85 deletions INSTALLING.rst
Original file line number Diff line number Diff line change
Expand Up @@ -66,109 +66,75 @@ Or clone using Git:
**HOOMD-blue** uses Git submodules. Either clone with the ``--recursive``
option, or execute ``git submodule update --init`` to fetch the submodules.

Configure a virtual environment
-------------------------------

When using a shared Python installation, create a `virtual environment
<https://docs.python.org/3/library/venv.html>`_ where you can install
**HOOMD-blue**::

$ python3 -m venv /path/to/environment --system-site-packages

Activate the environment before configuring and before executing
**HOOMD-blue** scripts::

$ source /path/to/environment/bin/activate

Tell CMake to search for packages in the virtual environment first::

$ export CMAKE_PREFIX_PATH=/path/to/environment

.. note::

Other types of virtual environments (such as *conda*) may work, but are not thoroughly tested.

Install prerequisites
---------------------

**HOOMD-blue** requires a number of libraries to build.
**HOOMD-blue** requires a number of libraries to build. The flags ``ENABLE_MPI``,
``ENABLE_GPU``, ``ENABLE_TBB``, and ``BUILD_JIT`` each require additional libraries.

- Required:
**General requirements**

- C++11 capable compiler (tested with ``gcc`` 4.8, 5.5, 6.4, 7,
8, 9, ``clang`` 5, 6, 7, 8)
- Python >= 3.5
- NumPy >= 1.7
- pybind11 >= 2.2
- Eigen >= 3.2
- CMake >= 3.9
- For MPI parallel execution (required when ``ENABLE_MPI=on``):
- C++11 capable compiler (tested with ``gcc`` 4.8, 5.5, 6.4, 7,
8, 9, ``clang`` 5, 6, 7, 8)
- Python >= 3.5
- NumPy >= 1.7
- pybind11 >= 2.2
- Eigen >= 3.2
- CMake >= 3.9

- MPI (tested with OpenMPI, MVAPICH)
- cereal >= 1.1 (required when ``ENABLE_MPI=on``)
**For MPI parallel execution** (required when ``ENABLE_MPI=on``)

- For GPU execution (required when ``ENABLE_GPU=on``):
- MPI (tested with OpenMPI, MVAPICH)
- cereal >= 1.1

- NVIDIA CUDA Toolkit >= 9.0
**For GPU execution** (required when ``ENABLE_GPU=on``)

**OR**
- NVIDIA CUDA Toolkit >= 9.0

- `AMD ROCm >= 2.9 <https://rocm.github.io/ROCmInstall.html>`_
*OR*

Additional dependencies:
- HIP [with ``hipcc`` and ``hcc`` as backend]
- rocFFT
- rocPRIM
- rocThrust
- hipCUB, included for NVIDIA GPU targets, but required as an
external dependency when building for AMD GPUs
- roctracer-dev
- Linux kernel >= 3.5.0
- `AMD ROCm >= 3.5.0 <https://rocm.github.io/ROCmInstall.html>`_ with additional dependencies:

For HOOMD-blue on AMD GPUs, the following limitations currently apply.
- HIP [with ``hipcc`` and ``hcc`` as backend]
- rocFFT
- rocPRIM
- rocThrust
- hipCUB, included for NVIDIA GPU targets, but required as an
external dependency when building for AMD GPUs
- roctracer-dev
- Linux kernel >= 3.5.0

1. Certain HOOMD-blue kernels trigger a `unknown HSA error <https://github.com/ROCm-Developer-Tools/HIP/issues/1662>`_.
A `temporary bugfix branch of HIP <https://github.com/glotzerlab/HIP/tree/hipfuncgetattributes_revertvectortypes>`_
addresses these problems. When using a custom HIP version, other libraries used by HOOMD-blue (``rocfft``) need
to be compiled against that same HIP version.
For HOOMD-blue on AMD GPUs, the following limitations currently apply.

2. The `mpcd` component is disabled on AMD GPUs.
1. Certain HOOMD-blue kernels trigger an `unknown HSA error <https://github.com/ROCm-Developer-Tools/HIP/issues/1662>`_.
2. The `mpcd` component is disabled on AMD GPUs.
3. Multi-GPU execution via unified memory is not available.

3. Multi-GPU execution via unified memory is not available.
**For threaded parallelism on the CPU** (required when ``ENABLE_TBB=on``)

- For threaded parallelism on the CPU (required when ``ENABLE_TBB=on``):
- Intel Threading Building Blocks >= 4.3

- Intel Threading Building Blocks >= 4.3
**For runtime code generation** (required when ``BUILD_JIT=on``)

- For runtime code generation (required when ``BUILD_JIT=on``):
- LLVM >= 5.0

- LLVM >= 5.0
**To build documentation**

- To build documentation:
- Doxygen >= 1.8.5
- Sphinx >= 1.6

- Doxygen >= 1.8.5
- Sphinx >= 1.6

Install these tools with your system or virtual environment package manager. HOOMD developers have had success with
Install these tools with your system or virtual environment package manager.
HOOMD developers have had success with
``pacman`` (`arch linux <https://www.archlinux.org/>`_), ``apt-get`` (`ubuntu <https://ubuntu.com/>`_), `Homebrew
<https://brew.sh/>`_ (macOS), and `MacPorts <https://www.macports.org/>`_ (macOS)::
<https://brew.sh/>`_ (macOS), and `MacPorts <https://www.macports.org/>`_ (macOS).
Note that packages may be named differently, so check your system's package list and install any ``-dev`` packages as needed. ::

$ your-package-manager install python python-numpy pybind11 eigen cmake openmpi cereal cuda

Typical HPC cluster environments provide python, numpy, cmake, cuda, and mpi, via a module system::

$ module load gcc python cuda cmake

.. note::

Packages may be named differently, check your system's package list. Install any ``-dev`` packages as needed.

.. tip::

You can install numpy and other python packages into your virtual environment::

python3 -m pip install numpy

Some package managers (such as *pip*) and most clusters are missing some or all of pybind11, eigen, and cereal.
``install-prereq-headers.py`` will install the missing packages into your virtual environment::

Expand All @@ -177,24 +143,36 @@ Some package managers (such as *pip*) and most clusters are missing some or all

Run ``python3 install-prereq-headers.py -h`` to see a list of the command line options.

Configure a virtual environment
-------------------------------

When using a shared Python installation, create a `virtual environment
<https://docs.python.org/3/library/venv.html>`_ where you can install the dependencies and
**HOOMD-blue**.
You can install numpy and other python packages into your virtual environment using, *e.g.*, ``python3 -m pip install numpy``.
Note that other types of virtual environments
(such as *conda*) may work, but are not thoroughly tested. ::

$ python3 -m venv /path/to/environment --system-site-packages


Compile HOOMD-blue
------------------

Configure::
Activate the environment and tell CMake to search for packages there
before configuring and installing **HOOMD-blue**. ::

$ source /path/to/environment/bin/activate
$ export CMAKE_PREFIX_PATH=/path/to/environment

By default, **HOOMD-blue** configures a *Release* optimized build type for a
generic CPU architecture and with no optional libraries::

$ cd /path/to/hoomd-blue
$ cmake -B build
$ cd build

.. warning::

Make certain you point ``CMAKE_PREFIX_PATH`` at your virtual environment so that CMake can find
packages there and correctly determine the installation location.::

$ export CMAKE_PREFIX_PATH=/path/to/environment

By default, **HOOMD-blue** configures a *Release* optimized build type for a
generic CPU architecture and with no optional libraries. Pass these options to cmake
Pass these options to cmake
to enable optimizations specific to your CPU::

-DCMAKE_CXX_FLAGS=-march=native -DCMAKE_C_FLAGS=-march=native
Expand Down Expand Up @@ -225,7 +203,7 @@ Execute longer running validation tests::

On a cluster, run tests within a job on a GPU compute node.

To install **HOOMD-blue** into your Python environment, run::
Install **HOOMD-blue** into your Python environment::

$ make install

Expand Down
72 changes: 45 additions & 27 deletions hoomd/Trigger.cc
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
#include <pybind11/stl.h>
#include <pybind11/stl_bind.h>

PYBIND11_MAKE_OPAQUE(std::vector<std::shared_ptr<Trigger> >);

//* Method to enable unit testing of C++ trigger calls from pytest
bool testTriggerCall(std::shared_ptr<Trigger> t, uint64_t step)
{
Expand Down Expand Up @@ -45,62 +43,82 @@ void export_Trigger(pybind11::module& m)
pybind11::arg("period"),
pybind11::arg("phase"))
.def(pybind11::init< uint64_t >(), pybind11::arg("period"))
.def_property("phase",
&PeriodicTrigger::getPhase,
&PeriodicTrigger::setPhase)
.def_property("period",
&PeriodicTrigger::getPeriod,
&PeriodicTrigger::setPeriod)
.def_property_readonly("phase", &PeriodicTrigger::getPhase)
.def_property_readonly("period", &PeriodicTrigger::getPeriod)
.def(pybind11::pickle(
[](const PeriodicTrigger& trigger)
{
return pybind11::make_tuple(
trigger.getPeriod(), trigger.getPhase());
},
[](pybind11::tuple params)
{
return PeriodicTrigger(params[0].cast<uint64_t>(),
params[1].cast<uint64_t>());
}))
;

pybind11::class_<BeforeTrigger, Trigger, std::shared_ptr<BeforeTrigger>
>(m, "BeforeTrigger")
.def(pybind11::init<uint64_t>(), pybind11::arg("timestep"))
.def_property("timestep",
&BeforeTrigger::getTimestep,
&BeforeTrigger::setTimestep)
.def_property_readonly("timestep", &BeforeTrigger::getTimestep)
.def(pybind11::pickle(
[](const BeforeTrigger& trigger)
{
return pybind11::make_tuple(trigger.getTimestep());
},
[](pybind11::tuple params)
{
return BeforeTrigger(params[0].cast<uint64_t>());
}))
;

pybind11::class_<OnTrigger, Trigger, std::shared_ptr<OnTrigger>
>(m, "OnTrigger")
.def(pybind11::init<uint64_t>(), pybind11::arg("timestep"))
.def_property("timestep",
&OnTrigger::getTimestep,
&OnTrigger::setTimestep)
.def_property_readonly("timestep", &OnTrigger::getTimestep)
.def(pybind11::pickle(
[](const OnTrigger& trigger)
{
return pybind11::make_tuple(trigger.getTimestep());
},
[](pybind11::tuple params)
{
return OnTrigger(params[0].cast<uint64_t>());
}))
;

pybind11::class_<AfterTrigger, Trigger, std::shared_ptr<AfterTrigger>
>(m, "AfterTrigger")
.def(pybind11::init<uint64_t>(), pybind11::arg("timestep"))
.def_property("timestep",
&AfterTrigger::getTimestep,
&AfterTrigger::setTimestep)
.def_property_readonly("timestep", &AfterTrigger::getTimestep)
.def(pybind11::pickle(
[](const AfterTrigger& trigger)
{
return pybind11::make_tuple(trigger.getTimestep());
},
[](pybind11::tuple params)
{
return AfterTrigger(params[0].cast<uint64_t>());
}))
;

pybind11::class_<NotTrigger, Trigger, std::shared_ptr<NotTrigger>
>(m, "NotTrigger")
.def(pybind11::init<std::shared_ptr<Trigger> >(),
pybind11::arg("trigger"))
.def_property("trigger",
&NotTrigger::getTrigger,
&NotTrigger::setTrigger)
.def_property_readonly("trigger", &NotTrigger::getTrigger)
;

pybind11::bind_vector<std::vector<std::shared_ptr<Trigger> >
>(m, "trigger_list");

pybind11::class_<AndTrigger, Trigger, std::shared_ptr<AndTrigger>
>(m, "AndTrigger")
.def(pybind11::init<pybind11::object>(),
pybind11::arg("triggers"))
.def_property_readonly("triggers", &AndTrigger::getTriggers)
.def(pybind11::init<pybind11::object>(), pybind11::arg("triggers"))
;

pybind11::class_<OrTrigger, Trigger, std::shared_ptr<OrTrigger>
>(m, "OrTrigger")
.def(pybind11::init<pybind11::object>(),
pybind11::arg("triggers"))
.def_property_readonly("triggers", &OrTrigger::getTriggers)
;

m.def("_test_trigger_call", &testTriggerCall);
Expand Down
Loading

0 comments on commit 5f0f657

Please sign in to comment.