-
Notifications
You must be signed in to change notification settings - Fork 23
/
porting_notes.txt
60 lines (40 loc) · 1.88 KB
/
porting_notes.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#
# Copyright (C) 2017, Northwestern University and Argonne National Laboratory
# See COPYRIGHT notice in top-level directory.
#
# $Id$
----------------------------------------------
Notes in this file are for PnetCDF developers
----------------------------------------------
These are some rough notes for porting code from the serial netcdf api to
the pnetcdf API. Pnetcdf is very similar but there are some changes that
have to be made:
. the nc_* functions are called ncmpi_*
. the nf_* functions are called nfmpi_*
. ncmpi_open takes a communicator and an info structure, in addition to the
parameters in the serial nc_open()
For example:
status = nc_open(path, NC_NOWRITE, &ncid);
becomes
status = ncmpi_open(MPI_COMM_WORLD, path, NC_NOWRITE,
MPI_INFO_NULL, &ncid);
. if you make any independent calls ( those not ending in _all), you must put
yourself into independent data mode with ncmpi_begin_indep_data(ncid) and
ncmpi_end_indep_data(ncid)
. FILL_DOUBLE and FILL_FLOAT are called NC_FILL_DOUBLE and NC_FILL_FLOAT
respectively. We do not define these NetCDF-2.x era constants in pnetcdf.
. #include <mpi.h> . If you want, define a communicator. MPI_COMM_WORLD
should work ok for most things.
. somewhere near main, call MPI_Init(): pnetcdf won't do that for you.
. pnetcdf does not implement nc_advise
. pnetcdf does not support all types that serial netcdf supports. see
src/lib/TODO for more specifics
. If for some reason your code uses 'ptrdiff_t' types, consider using
MPI_Offset types
. likewise, in many places where serial netcdf takes size_t types, we instead
take MPI_Offset types
. Fortran users should use '#include <mpif.h>' and '#include "pnetcdf.inc"',
instead of using the Fortran INCLUDE directive.
. Fortran 90 users can use 'use mpi' and 'use pnetcdf'.
. Fortran dimension sizes should be declared as type
INTEGER(KIND=MPI_OFFSET_KIND)