⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 winattr2f90.f90

📁 mpi并行计算的c++代码 可用vc或gcc编译通过 可以用来搭建并行计算试验环境
💻 F90
字号:
! This file created from test/mpi/f77/attr/winattr2f.f with f77tof90! -*- Mode: Fortran; -*- !!  (C) 2003 by Argonne National Laboratory.!      See COPYRIGHT in top-level directory.!  This is a modified version of winattrf.f that uses two of the!  default functions!      program main      use mpi      integer errs, ierr      integer (kind=MPI_ADDRESS_KIND) extrastate, valin, valout, val      integer comm, win, buf(10)      integer keyval      logical flag!! The only difference between the MPI-2 and MPI-1 attribute caching! routines in Fortran is that the take an address-sized integer! instead of a simple integer.  These still are not pointers,! so the values are still just integers. !      errs      = 0      call mtest_init( ierr )      call mpi_comm_dup( MPI_COMM_WORLD, comm, ierr )! Create a new window; use val for an address-sized int      val = 10      call mpi_win_create( buf, val, 1, &      &                        MPI_INFO_NULL, comm, win, ierr )!       extrastate = 1001      call mpi_win_create_keyval( MPI_WIN_DUP_FN,  &      &                            MPI_WIN_NULL_DELETE_FN, keyval,  &      &                             extrastate, ierr )      flag = .true.      call mpi_win_get_attr( win, keyval, valout, flag, ierr )      if (flag) then         errs = errs + 1         print *, ' get attr returned true when no attr set'      endif      valin = 2003      call mpi_win_set_attr( win, keyval, valin, ierr )      flag = .false.      valout = -1      call mpi_win_get_attr( win, keyval, valout, flag, ierr )      if (valout .ne. 2003) then         errs = errs + 1         print *, 'Unexpected value (should be 2003)', valout,  &      &            ' from attr'      endif            valin = 2001      call mpi_win_set_attr( win, keyval, valin, ierr )      flag = .false.      valout = -1      call mpi_win_get_attr( win, keyval, valout, flag, ierr )      if (valout .ne. 2001) then         errs = errs + 1         print *, 'Unexpected value (should be 2001)', valout,  &      &            ' from attr'      endif!! Test the attr delete function      call mpi_win_delete_attr( win, keyval, ierr )      flag = .true.      call mpi_win_get_attr( win, keyval, valout, flag, ierr )      if (flag) then         errs = errs + 1         print *, ' Delete_attr did not delete attribute'      endif      ! Test the delete function on window free      valin = 2001      call mpi_win_set_attr( win, keyval, valin, ierr )      call mpi_win_free( win, ierr )      ierr = -1      call mpi_win_free_keyval( keyval, ierr )      if (ierr .ne. MPI_SUCCESS) then         errs = errs + 1         call mtestprinterror( ierr )      endif      call mtest_finalize( errs )      call mpi_finalize( ierr )      end

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -