Can we analyze simulation data from HOOMD-blue at runtime by parallel?

57 views
Skip to first unread message

yunhan zhang

unread,
Aug 24, 2022, 3:42:19 AM8/24/22
to freud-users
Hi all,

I am using freud to compute the bond order parameter  on data generated by HOOMD-blue during a simulation run. I made a simple test as follows:

import freud
import hoomd
import matplotlib.pyplot as plt
import numpy as np
from hoomd import hpmc

hoomd.context.initialize("")
system = hoomd.init.create_lattice(hoomd.lattice.sc(a=1), n=20)
mc = hpmc.integrate.sphere(seed=42, d=0.1, a=0.1)
mc.shape_param.set("A", diameter=0.5)

w6 = freud.order.Steinhardt(l=6, wl=True)

def calc_W6(timestep):
    hoomd.util.quiet_status()
    snap = system.take_snapshot()
    hoomd.util.unquiet_status()
    w6.compute(system=snap, neighbors={"num_neighbors": 12})
    return np.mean(w6.particle_order)

# Equilibrate the system a bit before accumulating the RDF.
hoomd.analyze.callback(calc_W6, period=100)

logger = hoomd.analyze.log(
    filename="output.log",
    quantities=["w6"],
    period=100,
    header_prefix="#",
    overwrite=True,
)
logger.register_callback("w6", calc_W6)
hoomd.run(1e7)

I want to run it in parallel HOOMD-blue with multi cores, but there is the error reported:
** starting run **
Traceback (most recent call last):
  File "/home/yunhan/project/TEST/1/1.py", line 35, in <module>
    hoomd.run(1e7)
  File "/home/yunhan/opt/miniconda3/lib/python3.9/site-packages/hoomd/__init__.py", line 201, in run
    context.current.system.run(int(tsteps), callback_period, callback, limit_hours, int(limit_multiple));
  File "/home/yunhan/project/TEST/1/1.py", line 18, in calc_W6
    w6.compute(system=snap, neighbors={"num_neighbors": 12})
  File "util.pyx", line 165, in freud.util._Compute.__getattribute__.compute_wrapper
  File "order.pyx", line 657, in freud.order.Steinhardt.compute
  File "locality.pyx", line 920, in freud.locality._PairCompute._preprocess_arguments
  File "locality.pyx", line 368, in freud.locality.NeighborQuery.from_system
  File "locality.pyx", line 807, in freud.locality._RawPoints.__cinit__
ValueError: Cannot create a NeighborQuery with 0 particles.
--------------------------------------------------------------------------
MPI_ABORT was invoked on rank 1 in communicator MPI_COMM_WORLD
with errorcode 16.

NOTE: invoking MPI_ABORT causes Open MPI to kill all MPI processes.
You may or may not see output from other processes, depending on
exactly when Open MPI kills them.
--------------------------------------------------------------------------

Does any one know how to solve this problem? Thank you very much!

Yunhan

Joshua Anderson

unread,
Aug 24, 2022, 9:17:42 AM8/24/22
to yunhan zhang, freud-users
Yunhan,

HOOMD-blue does not duplicate particle snapshot data across ranks. Please see this tutorial for more information: https://hoomd-blue.readthedocs.io/en/v3.4.0/tutorial/03-Parallel-Simulations-With-MPI/03-Accessing-System-Configurations-With-MPI.html

You need to run your freud analysis on MPI rank 0 only. HOOMD-blue parallelizes over MPI *processes*, while freud parallelizes over *threads*. Configure your MPI job launcher and set the number of threads that freud uses accordingly.
------
Joshua A. Anderson, Ph.D.
Research Area Specialist, Chemical Engineering, University of Michigan

--
You received this message because you are subscribed to the Google Groups "freud-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to freud-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/freud-users/bc589323-6679-4aa0-87b1-af16ca1c6708n%40googlegroups.com.

Reply all
Reply to author
Forward
0 new messages