Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add system information #68

Merged
merged 18 commits into from
Aug 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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