Discussion:
Use module or use MPI_BCast?
(too old to reply)
Nicholas
2008-11-04 02:08:26 UTC
Permalink
If I want to share a variable globally in a fortran 90 program, I can
use module. In MPI, it is also possible to do this via the function
MPI_BCast.
So, what's the difference between them?
Dave Seaman
2008-11-04 13:26:21 UTC
Permalink
Post by Nicholas
If I want to share a variable globally in a fortran 90 program, I can
use module. In MPI, it is also possible to do this via the function
MPI_BCast.
So, what's the difference between them?
Approximately the same as the difference between a fish and a bicycle.

Each MPI process has its own private copy of the variable. It doesn't
matter whether it's defined in a module or not. If you want each
instance of the variable to have the same value, you can either have your
code assign the same value independently in each process, or you can use
MPI_Bcast.
--
Dave Seaman
Third Circuit ignores precedent in Mumia Abu-Jamal ruling.
<http://www.indybay.org/newsitems/2008/03/29/18489281.php>
Nicholas
2008-11-04 18:34:59 UTC
Permalink
Thank you very much.
I have just begin to learn MPI. I remembered to have tested this
feature but without result. Moments ago, I tested again and it turned
out to be what you have said.
Post by Dave Seaman
Post by Nicholas
If I want to share a variable globally in a fortran 90 program, I can
use module. In MPI, it is also possible to do this via the function
MPI_BCast.
So, what's the difference between them?
Approximately the same as the difference between a fish and a bicycle.
Each MPI process has its own private copy of the variable.  It doesn't
matter whether it's defined in a module or not.  If you want each
instance of the variable to have the same value, you can either have your
code assign the same value independently in each process, or you can use
MPI_Bcast.
--
Dave Seaman
Third Circuit ignores precedent in Mumia Abu-Jamal ruling.
<http://www.indybay.org/newsitems/2008/03/29/18489281.php>
Loading...