Skip to content

Commit

Permalink
Add system information (#68)
Browse files Browse the repository at this point in the history
* Add PrintSystemInfo functions
* Add number of nodes and update APIs
* Add accelerators support and skip onboard graphics
* Fix -Wtype-safety
* Add MPI and OpenMP info
* Fix compiler warnings with hypre's bigint build
* Add GPU RAM support
* Add support for ppc64le and MacOS
* MacOS fixes
  • Loading branch information
victorapm authored Aug 26, 2024
1 parent bf229fc commit 633cc67
Show file tree
Hide file tree
Showing 10 changed files with 608 additions and 54 deletions.
25 changes: 21 additions & 4 deletions include/HYPREDRV.h
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ HYPREDRV_Destroy(HYPREDRV_t*);
*
* Example Usage:
* @code
* uint32_t errorCode = HYPREDRV_PrintLibInfo();
* uint32_t errorCode = HYPREDRV_PrintLibInfo(comm);
* if (errorCode != 0) {
* const char* errorDescription = HYPREDRV_ErrorCodeDescribe(errorCode);
* printf("%s\n", errorDescription);
Expand All @@ -187,7 +187,24 @@ HYPREDRV_Destroy(HYPREDRV_t*);
*/

HYPREDRV_EXPORT_SYMBOL uint32_t
HYPREDRV_PrintLibInfo(void);
HYPREDRV_PrintLibInfo(MPI_Comm comm);

/**
* @brief Print system information.
*
* Example Usage:
* @code
* uint32_t errorCode = HYPREDRV_PrintSystemInfo(comm);
* if (errorCode != 0) {
* const char* errorDescription = HYPREDRV_ErrorCodeDescribe(errorCode);
* printf("%s\n", errorDescription);
* // Handle error
* }
* @endcode
*/

HYPREDRV_EXPORT_SYMBOL uint32_t
HYPREDRV_PrintSystemInfo(MPI_Comm comm);

/**
* @brief Print library information at exit.
Expand All @@ -201,7 +218,7 @@ HYPREDRV_PrintLibInfo(void);
*
* Example Usage:
* @code
* uint32_t errorCode = HYPREDRV_PrintExitInfo(argv[0]);
* uint32_t errorCode = HYPREDRV_PrintExitInfo(comm, argv[0]);
* if (errorCode != 0) {
* const char* errorDescription = HYPREDRV_ErrorCodeDescribe(errorCode);
* printf("%s\n", errorDescription);
Expand All @@ -211,7 +228,7 @@ HYPREDRV_PrintLibInfo(void);
*/

HYPREDRV_EXPORT_SYMBOL uint32_t
HYPREDRV_PrintExitInfo(const char*);
HYPREDRV_PrintExitInfo(MPI_Comm comm, const char*);

/**
* @brief Parse input arguments for a HYPREDRV object.
Expand Down
6 changes: 4 additions & 2 deletions include/info.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#ifndef INFO_HEADER
#define INFO_HEADER

#include <mpi.h>
#include <stdio.h>
#include <time.h>
#include "HYPRE.h"
Expand All @@ -18,7 +19,8 @@
*--------------------------------------------------------------------------*/

void PrintUsage(const char*);
void PrintLibInfo(void);
void PrintExitInfo(const char*);
void PrintLibInfo(MPI_Comm);
void PrintSystemInfo(MPI_Comm);
void PrintExitInfo(MPI_Comm, const char*);

#endif /* INFO_HEADER */
20 changes: 16 additions & 4 deletions src/HYPREDRV.c
Original file line number Diff line number Diff line change
Expand Up @@ -147,9 +147,21 @@ HYPREDRV_Destroy(HYPREDRV_t *obj_ptr)
*-----------------------------------------------------------------------------*/

uint32_t
HYPREDRV_PrintLibInfo(void)
HYPREDRV_PrintLibInfo(MPI_Comm comm)
{
PrintLibInfo();
PrintLibInfo(comm);

return ErrorCodeGet();
}

/*-----------------------------------------------------------------------------
* HYPREDRV_PrintSystemInfo
*-----------------------------------------------------------------------------*/

uint32_t
HYPREDRV_PrintSystemInfo(MPI_Comm comm)
{
PrintSystemInfo(comm);

return ErrorCodeGet();
}
Expand All @@ -159,9 +171,9 @@ HYPREDRV_PrintLibInfo(void)
*-----------------------------------------------------------------------------*/

uint32_t
HYPREDRV_PrintExitInfo(const char *argv0)
HYPREDRV_PrintExitInfo(MPI_Comm comm, const char *argv0)
{
PrintExitInfo(argv0);
PrintExitInfo(comm, argv0);

return ErrorCodeGet();
}
Expand Down
2 changes: 1 addition & 1 deletion src/containers.c
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ IntArrayUnique(MPI_Comm comm, IntArray *int_array)
}
}
}
MPI_Bcast(&int_array->g_unique_size, 1, MPI_INT, 0, comm);
MPI_Bcast(&int_array->g_unique_size, 1, MPI_UNSIGNED_LONG, 0, comm);
int_array->g_unique_data = (int*) calloc(int_array->g_unique_size, sizeof(int));

/* Compute global unique data */
Expand Down
Loading

0 comments on commit 633cc67

Please sign in to comment.