After Installation of PDI step, PDI must be used in the application, that is written either in C/C++, Fortran or Pyhton.
If you installed PDI to the system default location (such as /usr/ under linux), the library and plugins should be found without any problem. But you can always follow the directions for installation in a custom location to ensure everything is found.
To prepare environment in this case there are 3 options:
where <path/to/pdi/root> is the root of PDI installation.
To have the environment always setup for PDI, the first option (source PDI_path/share/pdi/env.bash) can be added to ~/.bash_profile file. After that, any new shell will have the environment set up.
For C make sure that source files that use PDI API include the pdi.h header (#include <pdi.h>). For Fortran make sure that source files that use PDI use PDI module (USE PDI).
The recommended way to compile your application is based on cmake.
To compile C/C++ applications, cmake must find the C component from PDI package and the PDI::PDI_C target must be linked to the application target: Because in order to initialize PDI, you also have to use Paraconf, you should do the same for Paraconf component C and target paraconf::paraconf.
To compile Fortran applications, cmake must find the C component from PDI and the PDI::PDI_f90 target must be linked to the application target. Because in order to initialize PDI, you also have to use Paraconf, you should do the same for Paraconf component f90 and target paraconf::paraconf_f90.
PDI is a shared library. That means that all environment variables must be set not only on compilation, but also when running the program.
Every used plugin in application needs to be found by PDI. PDI will search for plugins in 4 steps (it will use the first plugin found):
You may use the mock_pdi directory instead of the real PDI to compile your application. This directory contains a mock PDI implementation that you can use instead of the real PDI, if you prefer not or can not to install it on your specific system. The recommandation is to copy the mock_pdi dirctory into your own application directory so as to be able to use it when required.
There are two ways the mock PDI can be used: "SubdirMock" and "MockFind".
To use "SubdirMock", your need to introduce a new cmake option in your project. For example, in the PDI example, the option is called DISABLE_PDI.
Then, where you used to look for PDI, you will have to replace the call to find_package by a call to add_subdirectory. As parameter, pass the location where you copied the mock_pdi directory in your project.
With this approach, your code should be able to compile without PDI. Please note, that it will still require Paraconf however.
If you want to go further and make Paraconf optional too:
This will take care of your cmake. But while the paraconf::paraconf target will be provided that way, Paraconf itself will not be mocked. You will therefore have to #ifdef out any use you make of Paraconf in your code.
The two uses you most definitely make in your code are
And if your only use of Paraconf is for PDI, that's all you have to do.
If you use Paraconf beyond PDI, you will have to #ifdef out those usages too. Here you are on your own to provide sensible values instead of the one read from YAML by Paraconf.
For example:
You can find a full example of this approach in the example directory.
The only modification you need to make is to add the PDI_ROOT option to your CMake command to point to mock_pdi: