Thank you, Dave and Rajeey.<br><br>It seems I have to try other temporary methods. <br><br><div class="gmail_quote">2010/4/6 Dave Goodell <span dir="ltr">&lt;<a href="mailto:goodell@mcs.anl.gov">goodell@mcs.anl.gov</a>&gt;</span><br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">I think Rajeev is right, this is a bug in MPICH2.  But the good news is that it should be safe to call MPI_TYPE_COMMIT on the unnamed predefined types, which would get you un-stuck for the moment.<br>

<br>
-Dave<div><div></div><div class="h5"><br>
<br>
On Apr 5, 2010, at 10:41 PM, Rajeev Thakur wrote:<br>
<br>
</div></div><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;"><div><div></div><div class="h5">
Looks like this is a bug in MPICH2. It is saying that the datatype is not committed, whereas the datatype returned by type_create_f90_real is a predefined datatype that does not need to be committed. I have filed a bug report. You can try it here: <a href="https://trac.mcs.anl.gov/projects/mpich2/ticket/1028" target="_blank">https://trac.mcs.anl.gov/projects/mpich2/ticket/1028</a><br>

<br>
Rajeev<br>
<br>
From: <a href="mailto:mpich-discuss-bounces@mcs.anl.gov" target="_blank">mpich-discuss-bounces@mcs.anl.gov</a> [mailto:<a href="mailto:mpich-discuss-bounces@mcs.anl.gov" target="_blank">mpich-discuss-bounces@mcs.anl.gov</a>] On Behalf Of Jilong Yin<br>

Sent: Monday, April 05, 2010 10:24 PM<br>
To: <a href="mailto:mpich-discuss@mcs.anl.gov" target="_blank">mpich-discuss@mcs.anl.gov</a><br>
Subject: [mpich-discuss] How to use MPI_TYPE_CREATE_F90_REAL<br>
<br>
Hello, everyone<br>
<br>
  I am modifying my program to be used in user-specified real precision such as single/double/quad precision.<br>
  I use Fortran (Intel fortran)<br>
  But when I make the following test program, it failed and reported as this,.<br>
Fatal error in PMPI_Bcast: Invalid datatype, error stack:<br>
PMPI_Bcast(1301): MPI_Bcast(buf=0012FEE8, count=1, dtype=USER&lt;f90_real&gt;, root=0<br>
 MPI_COMM_WORLD) failed<br>
PMPI_Bcast(1252): Datatype has not been committed<br>
<br>
<br>
 I searched the web but can find little about this MPI_TYPE_CREATE_F90_REAL,<br>
Anyone can help me out?<br>
<br>
Thank you.<br>
<br>
<br>
ccccccccccccccccccccccccccccccccccccccccc<br>
<br>
      PROGRAM TEST<br>
    IMPLICIT NONE<br>
    INCLUDE &quot;MPIF.h&quot;<br>
<br>
C Define real type in different precision<br>
      INTEGER,PARAMETER::SP=SELECTED_REAL_KIND(6,37)<br>
    INTEGER,PARAMETER::DP=SELECTED_REAL_KIND(15,307)<br>
      INTEGER,PARAMETER::QP=SELECTED_REAL_KIND(33,4931)<br>
<br>
    INTEGER MYID,NUM_PROCS,IERR<br>
<br>
C MPI REAL DATA TYPE<br>
      INTEGER MPI_REAL_SP,MPI_REAL_DP,MPI_REAL_QP<br>
<br>
    REAL(KIND=SP)::s<br>
    REAL(KIND=DP)::d<br>
    REAL(KIND=QP)::q<br>
<br>
C Initialize MPI enviroment<br>
      CALL MPI_INIT(IERR)<br>
<br>
C get my Rank ID<br>
      CALL MPI_COMM_RANK(MPI_COMM_WORLD,MYID,IERR)<br>
<br>
C get the number of procs<br>
      CALL MPI_COMM_SIZE(MPI_COMM_WORLD,NUM_PROCS,IERR)<br>
<br>
C Output the precision and range for each real type<br>
      WRITE(6,10)PRECISION(1.0_SP),RANGE(1.0_SP),<br>
     &amp;           PRECISION(1.0_DP),RANGE(1.0_DP),<br>
     &amp;           PRECISION(1.0_QP),RANGE(1.0_QP)<br>
<br>
C Define MPI REAL Type<br>
      CALL MPI_TYPE_CREATE_F90_REAL(6,MPI_UNDEFINED,MPI_REAL_SP,IERR)<br>
      CALL MPI_TYPE_CREATE_F90_REAL(15,MPI_UNDEFINED,MPI_REAL_DP,IERR)<br>
      CALL MPI_TYPE_CREATE_F90_REAL(33,MPI_UNDEFINED,MPI_REAL_QP,IERR)<br>
<br>
<br>
c test real type<br>
      IF(MYID.EQ.0) THEN<br>
        s=1.0_SP<br>
      d=2.0_DP<br>
      q=3.0_QP<br>
    END IF<br>
<br>
c broadcast the above 3 values from master node<br>
      CALL MPI_BCAST(s,1,MPI_REAL_SP,0,MPI_COMM_WORLD,IERR)<br>
      CALL MPI_BCAST(d,1,MPI_REAL_DP,0,MPI_COMM_WORLD,IERR)<br>
      CALL MPI_BCAST(q,1,MPI_REAL_QP,0,MPI_COMM_WORLD,IERR)<br>
<br>
C output the result<br>
      PRINT*,&#39;MyID=&#39;,MYID,&#39; s=&#39;,s,&#39; d=&#39;,d,&#39; q=&#39;,q<br>
<br>
C finish the mpi enviroment<br>
      CALL MPI_FINALIZE(IERR)<br>
<br>
      STOP<br>
<br>
10    FORMAT(&#39;REAL PRECISION: SP(&#39;,I2,&#39;,&#39;,I4,&#39;)&#39;,1X,<br>
     &amp;                       &#39;DP(&#39;,I2,&#39;,&#39;,I4,&#39;)&#39;,1X,<br>
     &amp;                       &#39;QP(&#39;,I2,&#39;,&#39;,I4,&#39;)&#39;)<br>
<br>
      END<br>
<br>
cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc<br></div></div>
_______________________________________________<br>
mpich-discuss mailing list<div class="im"><br>
<a href="mailto:mpich-discuss@mcs.anl.gov" target="_blank">mpich-discuss@mcs.anl.gov</a><br>
</div><a href="https://lists.mcs.anl.gov/mailman/listinfo/mpich-discuss" target="_blank">https://lists.mcs.anl.gov/mailman/listinfo/mpich-discuss</a><br>
</blockquote>
<br>
_______________________________________________<br>
mpich-discuss mailing list<div class="im"><br>
<a href="mailto:mpich-discuss@mcs.anl.gov" target="_blank">mpich-discuss@mcs.anl.gov</a><br>
</div><a href="https://lists.mcs.anl.gov/mailman/listinfo/mpich-discuss" target="_blank">https://lists.mcs.anl.gov/mailman/listinfo/mpich-discuss</a><br>
</blockquote></div><br>