Scheduled Downtime
On Tuesday 24 October 2023 @ 5pm MT the forums will be in read only mode in preparation for the downtime. On Wednesday 25 October 2023 @ 5am MT, this website will be down for maintenance and expected to return online later in the morning.
Normal Operations
The forums are back online with normal operations. If you notice any issues or errors related to the forums, please reach out to help@ucar.edu

Errors when call shr_mpi_bcast

Mikasa

sky
Member
Hello, I am trying to add some code for reading some data in cime_comp_mod.F90 referring to the code of cpl reading restart file. But when I add the following line in the code,
call seq_comm_getinfo(CPLID, mpicom=mpicom_CPLID)
call shr_mpi_bcast(exists,mpicom_CPLID,'seq_io_read_avs exists')
the program will report a error:
Abort(201924613) on node 1229 (rank 1229 in comm 0): Fatal error in PMPI_Bcast: Invalid communicator, error stack:
PMPI_Bcast(451): MPI_Bcast(buf=0x7ffcfe2ecef4, count=1, MPI_INTEGER, root=0, comm=MPI_COMM_NULL) failed
PMPI_Bcast(390): Null communicator
I have ensured that the parameters passed into the shr_mpi_bcast are consistent with the same statement in seq_io_mod.F90.
Thank you very much for answering this question!
 

jedwards

CSEG and Liaisons
Staff member
It looks like you are calling the shr_mpi_bcast from ranks outside the coupler comm. You should not
need to broadcast the CPLID, it is already defined on all cpl tasks. Which comm you use in the read
depends on which component you want to use the data. Perhaps I can help further with a more complete
description of your goal.
 

Mikasa

sky
Member
It looks like you are calling the shr_mpi_bcast from ranks outside the coupler comm. You should not
need to broadcast the CPLID, it is already defined on all cpl tasks. Which comm you use in the read
depends on which component you want to use the data. Perhaps I can help further with a more complete
description of your goal.
Thanks very much for your reply! I want the component cpl to use the data so I pass the CPLID to shr_mpi_bcast . The reason why i call this subroutine is that I see similar code in the seq_io_mod.F90, like:
if (iam==0) inquire(file=trim(filename),exist=exists)
call shr_mpi_bcast(exists,mpicom,'seq_io_read_avs exists')
if (exists) then
rcode = pio_openfile(cpl_io_subsystem, pioid, cpl_pio_iotype, trim(filename),pio_nowrite)
So I guess, calling shr_mpi_bcast may be a necessary step before calling the pio_openfile to open my nc file.
My goal is to read in some data before the cime_run loop starts, then I will interpolate my data to the current model time during each loop. Finally, I use the data obtained by interpolation to replace the same varible computed by the model in the atm/ocn flux calculation formula. I have studied the program called in CPL to calculate atm/ocn flux. More specifically, variable 'replacement' means nudging in actual operation. I would appreciate it if you can help me !
 
Top