parallel.h 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. ///////////////////////////////////////////////////////////////////////////////////////
  2. /// \file parallel.h
  3. /// \brief Functionality for parallel computation
  4. ///
  5. /// Currently a layer over MPI with functionality LPJ-GUESS might need,
  6. /// but could be implemented as a layer over something else in future.
  7. ///
  8. /// The fact that MPI might not be available on the system where LPJ-GUESS
  9. /// was compiled is hidden by this module by simply pretending to be a
  10. /// "parallel" run with just one process.
  11. ///
  12. /// \author Joe Siltberg
  13. /// $Date: 2018-02-02 18:01:35 +0100 (ven, 02 fév 2018) $
  14. ///
  15. ///////////////////////////////////////////////////////////////////////////////////////
  16. #ifndef LPJ_GUESS_PARALLEL_H
  17. #define LPJ_GUESS_PARALLEL_H
  18. namespace GuessParallel {
  19. /// Initializes the module
  20. /** For instance by initializing underlying communications library.
  21. *
  22. * \param argc Passed along from main() to underlying communications library
  23. * \param argv Passed along from main() to underlying communications library
  24. */
  25. void init(int& argc, char**& argv);
  26. /// The process id of this process in the parallel run
  27. /** Returns zero when no MPI library is available/used. */
  28. int get_rank();
  29. /// The LOCAL process id of this process in the parallel run
  30. /** Returns zero when no MPI library is available/used. */
  31. int get_rank_specific(int lc);
  32. /// The number of LOCAL (i.e. LPJ-GUESS) processes involved in the parallel run
  33. /** Returns 1 when no MPI library is available/used. */
  34. int get_num_processes();
  35. /// The number of GLOBAL processes involved in the parallel run
  36. /** Returns 1 when no MPI library is available/used. */
  37. int get_num_global_processes();
  38. int get_num_local_processes(int lc);
  39. }
  40. #endif // LPJ_GUESS_PARALLEL_H