| ²é¿´: 1177 | »Ø¸´: 6 | ||
xianweiwangÌú³æ (СÓÐÃûÆø)
|
[ÇóÖú]
Õâ¶Î²¢ÐгÌÐòÓÐÎÊÌ⣬²»ÖªµÀ´íÔÚʲôµØ·½Çë´ó¼Ò¿´¿´£¡
|
|
MODULE GLOBAL implicit none type INDATA_TYPE real a real b integer n end type INDATA_TYPE END MODULE GLOBAL program Get_data3 use global include 'mpif.h' type(INDATA_TYPE) indata integer my_rank integer mesg_mpi_t integer ierr call MPI_INIT (ierr) call MPI_COMM_RANK (MPI_COMM_WORLD,my_rank,ierr) call MPI_COMM_SIZE (MPI_COMM_WORLD,numproc,ierr) print*, my_rank print*, numproc call MPI_Barrier(MPI_COMM_WORLD,ierr) if(my_rank.eq.0)then print *, 'Enter a, b, and n' read *, indata%a, indata%b, indata%n endif call Build_derived_type(indata, mesg_mpi_t) call MPI_BCAST(indata, 1, mesg_mpi_t, 0,MPI_COMM_WORLD,ierr ) print*, indata%a, indata%b, indata%n call MPI_Barrier(MPI_COMM_WORLD,ierr) call MPI_FINALIZE(ierr) end subroutine Build_derived_type(indata, mesg_mpi_t) use GLOBAL IMPLICIT NONE INCLUDE 'mpif.h' type(INDATA_TYPE) indata integer mesg_mpi_t integer ierr integer block_lengths(3) integer displacements(3) integer address(4) integer typelist(3) typelist(1) = MPI_REAL typelist(2) = MPI_REAL typelist(3) = MPI_INTEGER block_lengths(1) = 1 block_lengths(2) = 1 block_lengths(3) = 1 call MPI_address(indata, address(1), ierr) call MPI_address(indata%a, address(2), ierr) call MPI_address(indata%b, address(3), ierr) call MPI_address(indata%n, address(4), ierr) displacements(1) = address(2) - address(1) displacements(2) = address(3) - address(1) displacements(3) = address(4) - address(1) call MPI_TYPE_STRUCT(3, block_lengths, displacements, typelist, mesg_mpi_t, ierr) call MPI_TYPE_COMMIT(mesg_mpi_t, ierr) return end ÔËÐнá¹ûÊÇ mpirun -np 8 ./a.out 0 1 Enter a, b, and n 0 1 Enter a, b, and n 0 1 Enter a, b, and n 0 1 Enter a, b, and n 0 1 Enter a, b, and n 0 1 Enter a, b, and n 0 1 Enter a, b, and n 0 1 Enter a, b, and n forrtl: severe (24): end-of-file during read, unit -4, file stdin Image PC Routine Line Source a.out 00000000004B8891 Unknown Unknown Unknown ÕâÑù¿´Êǽø³ÌµÄ±àºÅ²»¶Ô£¬²»ÖªµÀΪʲôÕâÑù£¡ |
» ²ÂÄãϲ»¶
½ñÌìÎñί»á¿ªÍêÁË£¬Ã÷Ìì³ö½á¹ûÂð
ÒѾÓÐ8È˻ظ´
ÔÚ¼á±ù»¹¸Ç×ű±º£µÄʱºò£¬ÎÒ¿´µ½ÁËŷŵÄ÷»¨¡£
ÒѾÓÐ7È˻ظ´
½ñÈÕ²»·Å°ñ£¿Íø´«¹ú×ÔȻԤ¼Æ 8 Ô 27 Èտɲé½á¹û
ÒѾÓÐ22È˻ظ´
ijЩ»ú¹¹£¬ÒÔЧÂʵÍΪÈÙ£¬ÒÔЧÂʵÍ×÷Ϊ´æÔÚ¸Ð
ÒѾÓÐ9È˻ظ´
·Å°ñǰµÄ²»µ¶¨
ÒѾÓÐ18È˻ظ´
ʲôʱºò¿ª½±£¿
ÒѾÓÐ13È˻ظ´
Èç¹û´Ë¿ÌÄãÕýÔÚΪ¹ú»ù¸Ðµ½½¹ÂÇ£¬²»·ÁÀ´ÌýÌýÕâÊס¶»ù½ðÖ®Íâ¡·
ÒѾÓÐ8È˻ظ´
ûÓÐÈκÎÏûÏ¢-ÊDz»ÊǾÍÁ¹ÁË
ÒѾÓÐ10È˻ظ´
ÈËÆø²»ÐÐÁË
ÒѾÓÐ11È˻ظ´
2026¹ú×ÔÈ»º¯ÆÀ·Ñµ½ÕË
ÒѾÓÐ22È˻ظ´
» ±¾Ö÷ÌâÏà¹Ø¼ÛÖµÌùÍÆ¼ö£¬¶ÔÄúͬÑùÓаïÖú:
ÇóÖ¸µ¼£ºÏ뿼2013Ä꿼ÑУ¬µ«ÊDz»ÖªµÀѡʲôרҵ....
ÒѾÓÐ4È˻ظ´
ÇóÕæÏ࣬´ó¼Ò¿´¿´ÕâÆªCCLÓ¢ÎÄÎÄÕÂÊDz»ÊÇÓÐÎÊÌâ
ÒѾÓÐ19È˻ظ´
´ó¼Ò¿´¿´Õ⼸¸öBÀà´íÎó»áÓ°ÏìͶ¸å°É
ÒѾÓÐ3È˻ظ´
¡¾ÇóÖú¡¿ÔËÐдíÎ󣬴ó¼Ò¿´¿´ÎÊÌâÔÚÄÄ£¿
ÒѾÓÐ7È˻ظ´
snoopyzhao
ÖÁ×ðľ³æ (Ö°Òµ×÷¼Ò)
- ³ÌÐòÇ¿Ìû: 16
- Ó¦Öú: 157 (¸ßÖÐÉú)
- ¹ó±ö: 0.02
- ½ð±Ò: 18844.7
- ºì»¨: 29
- Ìû×Ó: 3803
- ÔÚÏß: 1422.4Сʱ
- ³æºÅ: 183750
- ×¢²á: 2006-02-13
- רҵ: ÎÛȾÉú̬»¯Ñ§
¡¾´ð°¸¡¿Ó¦Öú»ØÌû
¡ï
¸Ðл²ÎÓ룬ӦÖúÖ¸Êý +1
jjdg(½ð±Ò+1): ¸Ðл²ÎÓë 2012-01-14 00:07:27
¸Ðл²ÎÓ룬ӦÖúÖ¸Êý +1
jjdg(½ð±Ò+1): ¸Ðл²ÎÓë 2012-01-14 00:07:27
| ÄãµÄÊäÈë²»¶Ô°É£¬³ÌÐòÒªÈý¸öÊý£¬ÄãÖ»ÊäÈëÁ½¸ö£¿ |
2Â¥2012-01-13 13:41:14
xianweiwang
Ìú³æ (СÓÐÃûÆø)
- Ó¦Öú: 0 (Ó×¶ùÔ°)
- ½ð±Ò: 22.1
- É¢½ð: 610
- ºì»¨: 1
- Ìû×Ó: 60
- ÔÚÏß: 45.9Сʱ
- ³æºÅ: 963122
- ×¢²á: 2010-03-06
- רҵ: ÀíÂۺͼÆË㻯ѧ
3Â¥2012-01-13 15:05:21
xianweiwang
Ìú³æ (СÓÐÃûÆø)
- Ó¦Öú: 0 (Ó×¶ùÔ°)
- ½ð±Ò: 22.1
- É¢½ð: 610
- ºì»¨: 1
- Ìû×Ó: 60
- ÔÚÏß: 45.9Сʱ
- ³æºÅ: 963122
- ×¢²á: 2010-03-06
- רҵ: ÀíÂۺͼÆË㻯ѧ
4Â¥2012-01-13 15:08:30
cean
½ð³æ (Ö°Òµ×÷¼Ò)
ŒÅÉþÒ»Ìõ
- Ó¦Öú: 23 (СѧÉú)
- ½ð±Ò: 53.1
- É¢½ð: 2045
- ºì»¨: 2
- Ìû×Ó: 3442
- ÔÚÏß: 578.8Сʱ
- ³æºÅ: 1147499
- ×¢²á: 2010-11-15
- רҵ: ¹«¹²¹ØÏµÑ§
¡¾´ð°¸¡¿Ó¦Öú»ØÌû
¡ï
¸Ðл²ÎÓ룬ӦÖúÖ¸Êý +1
jjdg(½ð±Ò+1): ¸Ðл²ÎÓë 2012-01-16 10:11:43
¸Ðл²ÎÓ룬ӦÖúÖ¸Êý +1
jjdg(½ð±Ò+1): ¸Ðл²ÎÓë 2012-01-16 10:11:43
|
read *, indata%a, indata%b, indata%n ²»Ã÷°×¡£ÊÇ˵aµÄÀàÐÍÊÇindataô£¿ÄÇÑùa±¾Éí¾ÍÐèÒª3¸öÊýÁË¡£ |

5Â¥2012-01-16 04:31:45
xianweiwang
Ìú³æ (СÓÐÃûÆø)
- Ó¦Öú: 0 (Ó×¶ùÔ°)
- ½ð±Ò: 22.1
- É¢½ð: 610
- ºì»¨: 1
- Ìû×Ó: 60
- ÔÚÏß: 45.9Сʱ
- ³æºÅ: 963122
- ×¢²á: 2010-03-06
- רҵ: ÀíÂۺͼÆË㻯ѧ
6Â¥2012-01-16 12:48:43
cean
½ð³æ (Ö°Òµ×÷¼Ò)
ŒÅÉþÒ»Ìõ
- Ó¦Öú: 23 (СѧÉú)
- ½ð±Ò: 53.1
- É¢½ð: 2045
- ºì»¨: 2
- Ìû×Ó: 3442
- ÔÚÏß: 578.8Сʱ
- ³æºÅ: 1147499
- ×¢²á: 2010-11-15
- רҵ: ¹«¹²¹ØÏµÑ§
¡¾´ð°¸¡¿Ó¦Öú»ØÌû
¡ï
jjdg(½ð±Ò+1): ¸Ðл²ÎÓë 2012-01-17 10:08:46
jjdg(½ð±Ò+1): ¸Ðл²ÎÓë 2012-01-17 10:08:46
| ÄãÊÔÒ»ÏÂÏȶÁÊý£¬ºó¸³Öµ¸øindata. |

7Â¥2012-01-16 13:27:58









»Ø¸´´ËÂ¥