Skip to content

Reply To: Multi GPUs Calculation

#7634
Adrian
Keymaster

Yes, OpenLB of course uses MPI API calls internally but they are mostly hidden behind more convenient abstractions. Otherwise one would have to copy-and-paste the same communication (and spatial decompostion, load balancing, setup, …) code into each new simulation case. Making this more convenient and easier to maintain is one of the main points of having a software library for LBM. (The same way that the MPI software library abstracts the details on how to efficiently communicate messages accross diverse hardware).

The calls to our MPI wrapper functions in cavity3dBenchmark and only used to A) instantiate the cuboid geometry for the appropriate number of blocks (same as in all example cases) and B) to provide the user with output on the degree of parallelization for benchmark logging.

If you delete MPI API usage it will still work for single GPUs / CPUs, just not multiple of them. (referring to all MPI usage in OpenLB not just the logging in the cavity3d benchmark case)

In general you do not and should not need to understand the entire library structure in order to use it to setup your own cases. I would recommend to start by modifying an existing case for your application (or to continue with the case we setup together at the spring school), you will learn the required internals on the way. The point of these abstractions is exactly that: Abstraction. This way you can focus on your problem instead of the data structures, how to efficiently parallelize execution and so on.

For parallel computing basics I would suggest to check out some introductory university course (every compsci department should offer at least one, there likely are many recordings available on the net, e.g. from MIT (just quickly searched it on the web)).

The templated setProcessingContext call only synchronizes the given field. This is a performance optimization. Until you get more experience I would recommend to synchronize all data at the points where synchronization is necessary (the non-templated version of the function).