source: CIVL/examples/fortran/nek5000/core/byte_mpi.f

main
Last change on this file was ea777aa, checked in by Alex Wilton <awilton@…>, 3 years ago

Moved examples, include, build_default.properties, common.xml, and README out from dev.civl.com into the root of the repo.

git-svn-id: svn://vsl.cis.udel.edu/civl/trunk@5704 fb995dde-84ed-4084-dfe6-e5aef3e2452c

  • Property mode set to 100755
File size: 2.8 KB
Line 
1 subroutine byte_sync_mpi(mpi_fh)
2
3 include 'mpif.h'
4#ifndef NOMPIIO
5 call MPI_file_sync(mpi_fh,ierr)
6#else
7 call exitti('MPI_file_sync unsupported!$',0)
8#endif
9 return
10 end
11C--------------------------------------------------------------------------
12 subroutine byte_open_mpi(fnamei,mpi_fh,ifro,ierr)
13
14 include 'mpif.h'
15
16 common /nekmpi/ nid,np,nekcomm,nekgroup,nekreal
17
18 character fnamei*(*)
19 logical ifro
20
21 character*132 fname
22 character*1 fname1(132)
23 equivalence (fname1,fname)
24
25 l = ltrunc(fnamei,len(fnamei))
26 if(l+1.gt.len(fname))
27 $ call exitti('invalid string length$',l)
28
29 call chcopy(fname1 ,fnamei ,l)
30 call chcopy(fname1(l+1),char(0),1)
31
32 imode = MPI_MODE_WRONLY+MPI_MODE_CREATE
33 if(ifro) then
34 imode = MPI_MODE_RDONLY
35 endif
36
37#ifndef NOMPIIO
38 call MPI_file_open(nekcomm,fname,imode,
39 & MPI_INFO_NULL,mpi_fh,ierr)
40#else
41 call exitti('MPI_file_open unsupported!$',0)
42#endif
43
44 return
45 end
46C--------------------------------------------------------------------------
47 subroutine byte_read_mpi(buf,icount,iorank,mpi_fh,ierr)
48
49 include 'mpif.h'
50
51 real*4 buf(1) ! buffer
52
53 iout = icount ! icount is in 4-byte words
54#ifndef NOMPIIO
55 call MPI_file_read_all(mpi_fh,buf,iout,MPI_REAL,
56 & MPI_STATUS_IGNORE,ierr)
57#else
58 call exitti('MPI_file_read_all unsupported!$',0)
59#endif
60
61 return
62 end
63C--------------------------------------------------------------------------
64 subroutine byte_write_mpi(buf,icount,iorank,mpi_fh,ierr)
65
66 include 'mpif.h'
67 common /nekmpi/ nid,np,nekcomm,nekgroup,nekreal
68
69 real*4 buf(1) ! buffer
70
71 iout = icount ! icount is in 4-byte words
72 if(iorank.ge.0 .and. nid.ne.iorank) iout = 0
73#ifndef NOMPIIO
74 call MPI_file_write_all(mpi_fh,buf,iout,MPI_REAL,
75 & MPI_STATUS_IGNORE,ierr)
76#else
77 call exitti('MPI_file_write_all unsupported!$',0)
78#endif
79
80 return
81 end
82C--------------------------------------------------------------------------
83 subroutine byte_close_mpi(mpi_fh,ierr)
84
85 include 'mpif.h'
86
87#ifndef NOMPIIO
88 call MPI_file_close(mpi_fh,ierr)
89#else
90 call exitti('MPI_file_close unsupported!$',0)
91#endif
92
93 return
94 end
95C--------------------------------------------------------------------------
96 subroutine byte_set_view(ioff_in,mpi_fh)
97
98 include 'mpif.h'
99 integer*8 ioff_in
100
101 if(ioff_in.lt.0)
102 & call exitti('Invalid index in MPI_file_set_view!$',ioff_in)
103#ifndef NOMPIIO
104 call MPI_file_set_view(mpi_fh,ioff_in,MPI_BYTE,MPI_BYTE,
105 & 'native',MPI_INFO_NULL,ierr)
106#endif
107
108 return
109 end
Note: See TracBrowser for help on using the repository browser.