Commit 5e00d1cf authored by Shane Snyder's avatar Shane Snyder
Browse files

bug in darshan init for fortran programs

parent 2a6ab026
...@@ -54,7 +54,7 @@ static int mnt_data_count = 0; ...@@ -54,7 +54,7 @@ static int mnt_data_count = 0;
/* prototypes for internal helper functions */ /* prototypes for internal helper functions */
static void darshan_core_initialize( static void darshan_core_initialize(
int *argc, char ***argv); int argc, char **argv);
static void darshan_core_shutdown( static void darshan_core_shutdown(
void); void);
static void darshan_core_cleanup( static void darshan_core_cleanup(
...@@ -93,7 +93,15 @@ int MPI_Init(int *argc, char ***argv) ...@@ -93,7 +93,15 @@ int MPI_Init(int *argc, char ***argv)
return(ret); return(ret);
} }
darshan_core_initialize(argc, argv); if(argc && argv)
{
darshan_core_initialize(*argc, *argv);
}
else
{
/* we don't see argc and argv here in fortran */
darshan_core_initialize(0, NULL);
}
return(ret); return(ret);
} }
...@@ -108,7 +116,15 @@ int MPI_Init_thread(int *argc, char ***argv, int required, int *provided) ...@@ -108,7 +116,15 @@ int MPI_Init_thread(int *argc, char ***argv, int required, int *provided)
return(ret); return(ret);
} }
darshan_core_initialize(argc, argv); if(argc && argv)
{
darshan_core_initialize(*argc, *argv);
}
else
{
/* we don't see argc and argv here in fortran */
darshan_core_initialize(0, NULL);
}
return(ret); return(ret);
} }
...@@ -125,7 +141,7 @@ int MPI_Finalize(void) ...@@ -125,7 +141,7 @@ int MPI_Finalize(void)
/* *********************************** */ /* *********************************** */
static void darshan_core_initialize(int *argc, char ***argv) static void darshan_core_initialize(int argc, char **argv)
{ {
int i; int i;
int internal_timing_flag = 0; int internal_timing_flag = 0;
...@@ -160,11 +176,11 @@ static void darshan_core_initialize(int *argc, char ***argv) ...@@ -160,11 +176,11 @@ static void darshan_core_initialize(int *argc, char ***argv)
darshan_core->wtime_offset = DARSHAN_MPI_CALL(PMPI_Wtime)(); darshan_core->wtime_offset = DARSHAN_MPI_CALL(PMPI_Wtime)();
/* record exe and arguments */ /* record exe and arguments */
for(i=0; i<(*argc); i++) for(i=0; i<argc; i++)
{ {
chars_left = DARSHAN_EXE_LEN-strlen(darshan_core->exe); chars_left = DARSHAN_EXE_LEN-strlen(darshan_core->exe);
strncat(darshan_core->exe, (*argv)[i], chars_left); strncat(darshan_core->exe, argv[i], chars_left);
if(i < ((*argc)-1)) if(i < (argc-1))
{ {
chars_left = DARSHAN_EXE_LEN-strlen(darshan_core->exe); chars_left = DARSHAN_EXE_LEN-strlen(darshan_core->exe);
strncat(darshan_core->exe, " ", chars_left); strncat(darshan_core->exe, " ", chars_left);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment