Dear Carlie and David,
I am using CMAQ ADJOINT and my MPI runs do not work after a cluster update. I know it is a very old version and you guys might not be interested, but I desperately need your help to resolve the issue. I have tried with both GNU and Intel compilers. Here is what I get with gcc.
Program received signal SIGSEGV: Segmentation fault - invalid memory reference.
Backtrace for this error:
Backtrace for this error:
#0 0x14c6ba797acf in ???
#1 0x14c6ba815c95 in ???
#2 0x14c6ba799c50 in ???
#3 0x404d2e in ???
#4 0x5193c5 in par_init_
at src/par_init.F:162
#5 0x5e0e85 in driver_fwd
at src/driver_fwd.F:179
#6 0x5e3161 in main
at src/driver_fwd.F:44
Here is 179:
C Start up processor communication and define horizontal domain decomposition
C and vertical layer structure
CALL PAR_INIT(COLROW, NSPCSD, CLOCK, PAR_ERR)
IF ( PAR_ERR /= 0 ) THEN
XMSG = 'Error in PAR_INIT'
CALL M3EXIT(PNAME, JDATE, JTIME, XMSG, XSTAT1)
END IF
LOGDEV = INIT3()
IF ( NSPCSD .GT. MXVARS3 ) THEN
WRITE(XMSG,'(5X, A, I5, A)') 'The number of variables,', NSPCSD,
& ' to be written to the State CGRID File'
WRITE(LOGDEV, '(A)') XMSG
WRITE(XMSG,'(5X, A, I5)') 'exceeds the I/O-API limit:', MXVARS3
WRITE(LOGDEV, '(A)') XMSG
XMSG = 'Recompile with an I/O-API lib having a larger MXVARS3'
WRITE(LOGDEV, '(5X, A)') XMSG
CALL M3EXIT(PNAME, JDATE, JTIME, ' ', XSTAT1)
END IF
Also below is distr_env which is called in par_init:
extern void distr_env_ (int *myid_p, int *numprocs_p)
{
char **environ_ptr;
int env_size, total_size, total_size_0, str_size, avail_size;
int myid, numprocs;
char temp_buf[TEMP_BUF_SIZE], curr_str[CURR_STR_SIZE], *curr_ptr, *curr_name, *curr_val;
int ret, i, error;
myid = *myid_p;
numprocs = *numprocs_p;
if (myid == 0)
{ environ_ptr = environ;
env_size = 0;
total_size = 0;
i = 0;
while (environ_ptr[i++] != NULL)
{ env_size++;
total_size = total_size + strlen(environ_ptr[i-1]) + 1;
}
DEBUG( printf ("last of environment context is %s, total_size is %d. \n",
environ_ptr[env_size-1], total_size); )
total_size_0 = total_size;
curr_ptr = temp_buf;
avail_size = TEMP_BUF_SIZE;
for (i=0; i<env_size; i++)
{ str_size = strlen(environ_ptr[i]);
if ( (environ_ptr[i] != NULL)&&(avail_size > str_size) )
{ strcpy (curr_ptr, environ_ptr[i]);
curr_ptr = curr_ptr + str_size + 1;
avail_size = avail_size - str_size - 1;
}
else
{
printf ("your temp_buf in distr_env may not big enough to ");
printf ("hold next environmental pair \n");
exit (1);
}
}
}
error = MPI_Bcast (&total_size_0, 1, MPI_INT, 0, MPI_COMM_WORLD);
error = MPI_Bcast (temp_buf, total_size_0, MPI_CHAR, 0, MPI_COMM_WORLD);
if (myid != 0)
{
DEBUG( printf ("total_size_0 is: %d \n", total_size_0); )
curr_ptr = temp_buf;
while (curr_ptr < temp_buf+total_size_0)
{
if (strlen(curr_ptr) <= CURR_STR_SIZE)
{
strcpy (curr_str, curr_ptr);
curr_ptr = curr_ptr+strlen(curr_str)+1;
}
else
{
printf ("The curr_str buffer is not big enough! \n");
exit (1);
}
DEBUG( printf ("The current environmental value pair is: %s \n", curr_str); )
curr_name = strtok (curr_str, "=");
curr_val = strtok (NULL, "\0");
if ( ret = setenv (curr_name, curr_val, 0) )
{
printf ("error in setting environmental variable %s = %s. \n", curr_name, curr_val);
exit (1);
}
DEBUG( printf ("check the environmetal variable %s = %s. \n", curr_name, getenv(curr_name)); )
}
/* MPI_Barrier (MPI_COMM_WORLD); */
}
/*
else
{
MPI_Barrier (MPI_COMM_WORLD);
}
*/
MPI_Barrier (MPI_COMM_WORLD);
}
Your help is greatly appreciated.