printf("cant start hello other \n); vm exito node程序 hello other. c* #include"pvm. h # include“ string. h ptid char buf[100] ptid=pvm parentO; strcpy (buf, "hello, world from) gethostname( buf+strlen(buf), 64) pvm initsend( PvmDataDefault) pvm pkstr(buf) ito 4、计算兀可以通过MP程序。为了加深读者对MP的学习和理解,下面给出用 FORTRAN 90语言的实现版本。试分析其工作过程。 计算的MPI(F90)编程代码段*∥ double precision P125DT parameter(PI25DI=3.141592653589793238462643d0 mpi, pi, h, su integer n, myid, numprocs, i, rc function to integrate f(a)=4d0/(1.d0+aa) all MPI INIT(ierr) all MPI COMM RANK(MPI COMM WORLD, myid, ierr) call MPI COMM SIZE(MPI COMM WORLD, numprocs, ierr) print*, process, myid, of', numprocs, "is alive (myid. eq. O)ther te(6,98) format("Enter the number of intervals: (0 quit)) ad(5,99)nprintf(“can’t start hello_other \n”); pvm_exit(); } /*node 程序 hello_other.c*/ #include “pvm3.h” #include “string.h” main() { int ptid; char buf[100]; ptid=pvm_parent(); strcpy(buf, “hello, world from”); gethostname(buf+strlen(buf), 64); pvm_initsend(PvmDataDefault); pvm_pkstr(buf); pvm_send(ptid, 1); pvm_exit(); exit(0); } 4、计算 π 可以通过 MPI 程序。为了加深读者对 MPI 的学习和理解,下面给出用 FORTRAN 90 语言的实现版本。试分析其工作过程。 //*计算 π 的 MPI(F90)编程代码段*// program main use mpi double precision PI25DT parameter (PI25DT=3.141592653589793238462643d0) double precision mypi, pi, h, sum, x, f, a integer n, myid, numprocs, i, rc ! function to integrate f(a) = 4.d0/(1.d0+a*a) call MPI_INIT(ierr) call MPI_COMM_RANK(MPI_COMM_WORLD, myid, ierr) call MPI_COMM_SIZE(MPI_COMM_WORLD, numprocs, ierr) print *, ‘process’, myid, ‘of’, numprocs, ‘is alive’ sizetype=1 sumtype=2 do if (myid.eq.0) then write(6, 98) 98 format(‘Enter the number of intervals: (0 quit)’) read(5, 99)n