Parallel programming with O2scl

Generally, O2scl objects are thread-safe in the same way that classes like std::vector<double> are thread-safe: reads are safe and writes are unsafe. It may be useful to make objects const to ensure that one is reading data in a thread-safe way.

MPI programming with O2scl is also straightforward. The sole exception is O2scl has two global objects, the library settings object and the error handler object, which may need to be separately instantiated by the user on each thread.

For example, on some systems, the following may be required to ensure that the error handler is valid on each thread.

int main(int argc, char *argv[]) {
cout.setf(ios::scientific);
MPI_Init(&argc,&argv);
// Create a new error handler for this thread
// Do stuff here
MPI_Finalize();
return 0;
}

Documentation generated with Doxygen. Provided under the GNU Free Documentation License (see License Information).