回 帖 发 新 帖 刷新版面

主题:openmpi 已经装好,数据类型设置有疑问,求解答

原来带的例子运行的很好,例子如下:

C
C Copyright (c) 2004-2006 The Trustees of Indiana University and Indiana
C                         University Research and Technology
C                         Corporation.  All rights reserved.
C Copyright (c) 2006      Cisco Systems, Inc.  All rights reserved.
C
C Sample MPI "hello world" application in Fortran 77
C
        program main
        implicit none
        include 'mpif.h'
        integer ierr, rank, size

        call MPI_INIT(ierr)
        call MPI_COMM_RANK(MPI_COMM_WORLD, rank, ierr)
        call MPI_COMM_SIZE(MPI_COMM_WORLD, size, ierr)
          

        print *, "Hello, world, I am ", rank, " of ", size
        call MPI_FINALIZE(ierr)

        end

我自己修改了下,只是在里面添加了几个数据类型,就提示出问题了.我修改的程序如下:

 

C
C Copyright (c) 2004-2006 The Trustees of Indiana University and Indiana
C                         University Research and Technology
C                         Corporation.  All rights reserved.
C Copyright (c) 2006      Cisco Systems, Inc.  All rights reserved.
C
C Sample MPI "hello world" application in Fortran 77
C
        program main
        implicit none
        include 'mpif.h'
        integer ierr, rank, size

        call MPI_INIT(ierr)
        call MPI_COMM_RANK(MPI_COMM_WORLD, rank, ierr)
        call MPI_COMM_SIZE(MPI_COMM_WORLD, size, ierr)
         integer i,j,k
         real a1,a2
         a1=0.2
         do i=1,20
           do j=1,10
             a2=i*a1-j
           enddo
         enddo
         
          

        print *, a2, size
        call MPI_FINALIZE(ierr)

        end

出现问题如下:

 

ello_f77.f:17.72:

         integer i,j,k
                                                                        1
Error: Unexpected data declaration statement at (1)

.......下面还好几个,谁知道是怎么回事吗?该怎么修改呢?

 

 

 

 

 

回复列表 (共2个回复)

沙发

论坛搜索下,Error: Unexpected data declaration statement 还真没发现这个问题怎么处理的

板凳

call MPI_INIT(ierr)
call MPI_COMM_RANK(MPI_COMM_WORLD, rank, ierr)
call MPI_COMM_SIZE(MPI_COMM_WORLD, size, ierr)
integer i,j,k
real a1,a2
位置搞错了

我来回复

您尚未登录,请登录后再回复。点此登录或注册