New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
new MESSAGE package for client/server/coupling #1013
Merged
Changes from all commits
Commits
Show all changes
33 commits
Select commit
Hold shift + click to select a range
2f55981
new MESSAGE package for client/server/coupling
8495fb6
Add preliminary cmake support
rbberger b08a2fc
mended un-done changes from Git master
c2c654c
CMake additions to new MESSAGE package
2e93202
Merge branch 'cslib' of github.com:lammps/lammps into cslib
ab1cc70
change syntax of standard C include files
1aa8307
change CSlib files to BSD license
a4dbac6
more updates to the new MESSAGE package
b2c75cc
enable LAMMPS/VASP coupling to work w/out using VASP
b2d1332
change proc count to color for MPI_Comm_split
781ddc0
update to CSlib website link
c4b5538
doc updates
89a3670
merge master into cslib branch, update docs
4e13ce1
add back in MESSAGE package info in CMakeLists.txt
03b880a
more doc page updates
8930a88
enrich the AIMD interface
33d5fe4
re-merge with current master
735ec9d
more general MD c/s protocol
d8b087a
docs for MD protocol enhancements
c477129
real <-> metal unit conversion factors
cb318f5
Add missing or lost cmake changes
rbberger 30d45e6
Ensure MESSAGE files are added to CMake compilation
rbberger 83d453e
updates to MD protocol and examples
9445742
Merge branch 'cslib' of github.com:lammps/lammps into cslib
6ea33e3
Fix typo and use ZMQ stubs in CMake when necessary
rbberger 4c32a55
Rename to libcs.a
rbberger a7e9076
Rename to libcsmpi/libcsnompi like in Makefile
rbberger 0860b9e
Build cslib static or as shared
rbberger bc62002
units and doc changes
f66ce80
final testing
78301e5
Merge branch 'master' into cslib
a299a7f
Merge branch 'cslib' of github.com:lammps/lammps into cslib
5f0423b
change -mpi to -mpicolor
File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
find_path(ZMQ_INCLUDE_DIR zmq.h) | ||
find_library(ZMQ_LIBRARY NAMES zmq) | ||
|
||
set(ZMQ_LIBRARIES ${ZMQ_LIBRARY}) | ||
set(ZMQ_INCLUDE_DIRS ${ZMQ_INCLUDE_DIR}) | ||
|
||
include(FindPackageHandleStandardArgs) | ||
find_package_handle_standard_args(ZMQ DEFAULT_MSG ZMQ_LIBRARY ZMQ_INCLUDE_DIR) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,131 @@ | ||
"Higher level section"_Howto.html - "LAMMPS WWW Site"_lws - "LAMMPS | ||
Documentation"_ld - "LAMMPS Commands"_lc :c | ||
|
||
:link(lws,http://lammps.sandia.gov) | ||
:link(ld,Manual.html) | ||
:link(lc,Commands_all.html) | ||
|
||
:line | ||
|
||
Using LAMMPS in client/server mode | ||
|
||
Client/server coupling of two codes is where one code is the "client" | ||
and sends request messages to a "server" code. The server responds to | ||
each request with a reply message. This enables the two codes to work | ||
in tandem to perform a simulation. LAMMPS can act as either a client | ||
or server code. | ||
|
||
Some advantages of client/server coupling are that the two codes run | ||
as stand-alone executables; they are not linked together. Thus | ||
neither code needs to have a library interface. This often makes it | ||
easier to run the two codes on different numbers of processors. If a | ||
message protocol (format and content) is defined for a particular kind | ||
of simulation, then in principle any code that implements the | ||
client-side protocol can be used in tandem with any code that | ||
implements the server-side protocol, without the two codes needing to | ||
know anything more specific about each other. | ||
|
||
A simple example of client/server coupling is where LAMMPS is the | ||
client code performing MD timestepping. Each timestep it sends a | ||
message to a server quantum code containing current coords of all the | ||
atoms. The quantum code computes energy and forces based on the | ||
coords. It returns them as a message to LAMMPS, which completes the | ||
timestep. | ||
|
||
Alternate methods for code coupling with LAMMPS are described on | ||
the "Howto couple"_Howto_couple.html doc page. | ||
|
||
LAMMPS support for client/server coupling is in its "MESSAGE | ||
package"_Packages_details.html#PKG-MESSAGE which implements several | ||
commands that enable LAMMPS to act as a client or server, as discussed | ||
below. The MESSAGE package also wraps a client/server library called | ||
CSlib which enables two codes to exchange messages in different ways, | ||
either via files, sockets, or MPI. The CSlib is provided with LAMMPS | ||
in the lib/message dir. The CSlib has its own | ||
"website"_http://cslib.sandia.gov with documentation and test | ||
programs. | ||
|
||
NOTE: For client/server coupling to work between LAMMPS and another | ||
code, the other code also has to use the CSlib. This can sometimes be | ||
done without any modifications to the other code by simply wrapping it | ||
with a Python script that exchanges CSlib messages with LAMMPS and | ||
prepares input for or processes output from the other code. The other | ||
code also has to implement a matching protocol for the format and | ||
content of messages that LAMMPS exchanges with it. | ||
|
||
These are the commands currently in the MESSAGE package for two | ||
protocols, MD and MC (Monte Carlo). New protocols can easily be | ||
defined and added to this directory, where LAMMPS acts as either the | ||
client or server. | ||
|
||
"message"_message.html | ||
"fix client md"_fix_client_md.html = LAMMPS is a client for running MD | ||
"server md"_server_md.html = LAMMPS is a server for computing MD forces | ||
"server mc"_server_mc.html = LAMMPS is a server for computing a Monte Carlo energy | ||
|
||
The server doc files give details of the message protocols | ||
for data that is exchanged bewteen the client and server. | ||
|
||
These example directories illustrate how to use LAMMPS as either a | ||
client or server code: | ||
|
||
examples/message | ||
examples/COUPLE/README | ||
examples/COUPLE/lammps_mc | ||
examples/COUPLE/lammps_vasp :ul | ||
|
||
The examples/message dir couples a client instance of LAMMPS to a | ||
server instance of LAMMPS. | ||
|
||
The lammps_mc dir shows how to couple LAMMPS as a server to a simple | ||
Monte Carlo client code as the driver. | ||
|
||
The lammps_vasp dir shows how to couple LAMMPS as a client code | ||
running MD timestepping to VASP acting as a server providing quantum | ||
DFT forces, thru a Python wrapper script on VASP. | ||
|
||
Here is how to launch a client and server code together for any of the | ||
4 modes of message exchange that the "message"_message.html command | ||
and the CSlib support. Here LAMMPS is used as both the client and | ||
server code. Another code could be subsitituted for either. | ||
|
||
The examples below show launching both codes from the same window (or | ||
batch script), using the "&" character to launch the first code in the | ||
background. For all modes except {mpi/one}, you could also launch the | ||
codes in separate windows on your desktop machine. It does not | ||
matter whether you launch the client or server first. | ||
|
||
In these examples either code can be run on one or more processors. | ||
If running in a non-MPI mode (file or zmq) you can launch a code on a | ||
single processor without using mpirun. | ||
|
||
IMPORTANT: If you run in mpi/two mode, you must launch both codes via | ||
mpirun, even if one or both of them runs on a single processor. This | ||
is so that MPI can figure out how to connect both MPI processes | ||
together to exchange MPI messages between them. | ||
|
||
For message exchange in {file}, {zmq}, or {mpi/two} modes: | ||
|
||
% mpirun -np 1 lmp_mpi -log log.client < in.client & | ||
% mpirun -np 2 lmp_mpi -log log.server < in.server :pre | ||
|
||
% mpirun -np 4 lmp_mpi -log log.client < in.client & | ||
% mpirun -np 1 lmp_mpi -log log.server < in.server :pre | ||
|
||
% mpirun -np 2 lmp_mpi -log log.client < in.client & | ||
% mpirun -np 4 lmp_mpi -log log.server < in.server :pre | ||
|
||
For message exchange in {mpi/one} mode: | ||
|
||
Launch both codes in a single mpirun command: | ||
|
||
mpirun -np 2 lmp_mpi -mpicolor 0 -in in.message.client -log log.client : -np 4 lmp_mpi -mpicolor 1 -in in.message.server -log log.server | ||
|
||
The two -np values determine how many procs the client and the server | ||
run on. | ||
|
||
A LAMMPS executable run in this manner must use the -mpicolor color | ||
command-line option as their its option, where color is an integer | ||
label that will be used to distinguish one executable from another in | ||
the multiple executables that the mpirun command launches. In this | ||
example the client was colored with a 0, and the server with a 1. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we move that glob part in the
SIMPLELIB
loop?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@junghans have a look at the lib and the source folder, the names don't match. that's why I did it this way.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point!