CSlib, a client/server messaging library for scientific applications
"The medium is the message. -- Marshall McLuhan
"My life is my message. - Mahatma Gandhi
"If you want a love message to be heard, it has got to be sent out. -
This is the home page for the client/server messaging library (CSlib).
It is a lightweight implementation of the client/server model suitable
for coupling two scientific applications runnning in serial or
The client/server model is a messaging paradigm, used
ubiquitously by web-based applications, where one or more clients
(e.g. your phone) communicate with a server (e.g. a website). In the
context of the CSlib, it can used to couple two scientific
applications (apps) together where one app acts as the "client" and
the other as the "server". The client sends messages to the server
requesting it perform specific computations and return the results.
Advantages of this mode of coupling, supported by the CSlib, are as
- Messaging can be done by files, sockets (using the ZMQ library),
- The CSlib can be used from C++, C, Fortran, or Python. Or any
language which can make calls to a C-style API.
- The two apps operate as standalone executables; neither needs a
library interface since they are not linked to each other.
- Each app can run in serial or parallel, or on different numbers of
processors. They can be launched on the same or different physical
processors of a parallel machine. Socket communication means the two
apps can run on geographically distinct machines.
- Modifying an app to work as a client or server via the CSlib can be
done in one of two ways. Calls to the CSlib can be added to the app,
or a wrapper program (e.g. a Python script) can be written which calls
the CSlib, creates input for the app, invokes it, and parses its
- Multiple instances of the CSlib can be used to couple more than 2 apps
to each other in different patterns.
- A communication prototcol can be defined for a particular style of
coupling. In principle this allows any client code of type A to be
coupled to any server code of type B, so long as both codes implement
the AB protocol via the CSlib. An example is explained below for ab
initio molecular dynamics.
A limitation of the CSlib, is that it's meant for loose coupling of
two apps when the cost of the data exchange is not
performance-critical. It is not designed for tight-coupling scenarios
where large volumes of data need to be exchanged rapidly between large
numbers of processors. Other kinds of messaging paradigms and
toolkits exist for that purpose. See the intro page
of the CSlib manaul for some links.
The CSlib is used in LAMMPS, a parallel
molecular dynamics (MD) code, via its MESSAGE package. These example
use cases are included in the LAMMPS distribution:
- A Monte Carlo (MC) client code uses LAMMPS as a server for energy
evaluations and dynamics runs between MC moves.
- LAMMPS runs in client mode to perform ab initio MD using the VASP
quantum DFT code as a server for energy/force/virial computations. If
the protocol (what messages to send and receive) were implemented by
another quantum code, it could be coupled to LAMMPS with no additional
changes (to LAMMPS). And vice versa for another MD code coupling to
VASP (or another quantum code).
The CSlib is an open-source code, distributed freely under the terms
of the modified Berkeley Software Distribution (BSD) License.
See this page for more details. It was developed
at Sandia National Laboratories, a US Department of Energy
facility, for use in coupling scientific applications running on
desktop machines to large supercomputers. Funding for the CSlib came
from DOE's Office of Advanced Scientific Computing Program
(OASCR) under the auspices of its Exascale Computing Program
The author of the CSlib is Steve Plimpton, who can be contacted
at sjplimp at sandia.gov.
The CSlib WWW site is hosted by Sandia, which has this Privacy and
Recent CSlib News
- (8/18) Initial open-source release of the CSlib.