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

📄 read_all.c

📁 The example for Boor USING MPI2
💻 C
字号:
/* noncontiguous access with a single collective I/O function */#include "mpi.h"#define FILESIZE      1048576    #define INTS_PER_BLK  16int main(int argc, char **argv){    int *buf, rank, nprocs, nints, bufsize;    MPI_File fh;    MPI_Datatype filetype;    MPI_Init(&argc,&argv);    MPI_Comm_rank(MPI_COMM_WORLD, &rank);    MPI_Comm_size(MPI_COMM_WORLD, &nprocs);    bufsize = FILESIZE/nprocs;    buf = (int *) malloc(bufsize);    nints = bufsize/sizeof(int);    MPI_File_open(MPI_COMM_WORLD, "/pfs/datafile", MPI_MODE_RDONLY,                  MPI_INFO_NULL, &fh);    MPI_Type_vector(nints/INTS_PER_BLK, INTS_PER_BLK,                     INTS_PER_BLK*nprocs, MPI_INT, &filetype);    MPI_Type_commit(&filetype);    MPI_File_set_view(fh, INTS_PER_BLK*sizeof(int)*rank, MPI_INT, 		      filetype, "native", MPI_INFO_NULL);    MPI_File_read_all(fh, buf, nints, MPI_INT, MPI_STATUS_IGNORE);    MPI_File_close(&fh);    MPI_Type_free(&filetype);    free(buf);    MPI_Finalize();    return 0; }

⌨️ 快捷键说明

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