ipc_debug.h 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. #pragma once
  2. #include <stdint.h>
  3. #include <stddef.h>
  4. #ifdef __cplusplus
  5. // Only expose templated version with C++
  6. template<typename T>
  7. void debug_ipc_assert_equal(T value);
  8. extern "C" {
  9. #endif
  10. #define DEBUG_IPC_CHECKPOINT() debug_ipc_assert_source_location(__FILE__, __LINE__)
  11. void debug_ipc_init();
  12. void debug_ipc_assert_equal_double(double value);
  13. void debug_ipc_assert_equal_uint(uint32_t value);
  14. void debug_ipc_assert_equal_int(int32_t value);
  15. void debug_ipc_assert_equal_int64(int64_t value);
  16. void debug_ipc_assert_equal_array(void *value, size_t size);
  17. /**
  18. * Check that root and client are executing the same source line.
  19. * Should typically be called like this:
  20. * debug_ipc_assert_source_location(__FILE__, __LINE__)
  21. */
  22. void debug_ipc_assert_source_location(const char *source_file, const long int line_number);
  23. /**
  24. * Debug IPC also allows comparing across multiple MPI ranks with differing cluster sizes.
  25. * This method can be used to define the order of ranks.
  26. */
  27. void debug_ipc_mpi_set_data_distribution(int start_index);
  28. /**
  29. * Compare two MPI distributed arrays between processes.
  30. * array_length denotes the local number of double elements in the array, not the number of bytes.
  31. *
  32. * The data distribution must be given through `debug_ipc_mpi_set_data_distribution` before calling
  33. * this method.
  34. */
  35. void debug_ipc_assert_equal_mpi_double_array(double *array, size_t array_length);
  36. #ifdef __cplusplus
  37. }
  38. #endif