view.c

来自「The example for Boor USING MPI2」· C语言 代码 · 共 32 行

C
32
字号
#include "mpi.h"int main( int argc, char *argv[] ){    MPI_Aint     lb, extent;    MPI_Datatype etype, filetype, contig;    MPI_Offset   disp;    MPI_File     fh;    int buf[1000];    MPI_Init( &argc, &argv );    /* ... other application code ... */    MPI_File_open(MPI_COMM_WORLD, "/pfs/datafile", 		  MPI_MODE_CREATE | MPI_MODE_RDWR, MPI_INFO_NULL, &fh);    MPI_Type_contiguous(2, MPI_INT, &contig);    lb     = 0;    extent = 6 * sizeof(int);    MPI_Type_create_resized(contig, lb, extent, &filetype);    MPI_Type_commit(&filetype);    disp  = 5 * sizeof(int);    /* assume displacement in this file view 				   is of size equal to 5 integers */     etype = MPI_INT;        MPI_File_set_view(fh, disp, etype, filetype, "native", 		      MPI_INFO_NULL);    MPI_File_write(fh, buf, 1000, MPI_INT, MPI_STATUS_IGNORE);    /* ... */    MPI_Finalize();    return 0;}

⌨️ 快捷键说明

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