(1) MPI-IO: 基本函数 open, close, write_shared
来源:互联网 发布:photoshop软件怎么购买 编辑:程序博客网 时间:2024/06/03 19:07
/** * int MPI_File_open(MPI_Comm comm, char *filename, int amode, MPI_Info info, MPI_File *fh); * int MPI_File_close(MPI_File *fh); * * int MPI_File_write_shared(MPI_File fh, void *buf, int count, MPI_Datatype datatype, MPI_Status *status) * * * int MPI_File_set_size(MPI_File fh, MPI_Offset size); * int MPI_File_get_size(MPI_File fh, MPI_Offset * size); * * int MPI_File_get_amode(MPI_File fh, int * amode); */#include<stdio.h>#include<stdlib.h>#include"mpi.h"int main(int argc, char *argv[]){int totalTaskNum, rankID;MPI_Init(&argc, &argv);MPI_Comm_rank(MPI_COMM_WORLD, &rankID);MPI_Comm_size(MPI_COMM_WORLD, &totalTaskNum);char processorName[MPI_MAX_PROCESSOR_NAME];int resultLength;MPI_Get_processor_name(processorName,&resultLength);char buf[128];sprintf(buf, "totalTaskNum=%d, rankID=%d, proccessor_name=%s, processor_name's length = %d\n",totalTaskNum, rankID, processorName, resultLength);char *filename = "file.txt";MPI_File fh;MPI_Status status;MPI_File_open(MPI_COMM_WORLD, filename, MPI_MODE_CREATE | MPI_MODE_RDWR, MPI_INFO_NULL, &fh);MPI_File_write_shared(fh, buf, sizeof(buf), MPI_CHAR, &status);MPI_Offset file_size;MPI_File_get_size(fh, &file_size);int amode;MPI_File_get_amode(fh, &amode);printf("ranID = %d, file_size = %lld, amode = %d\n", rankID, file_size, amode);MPI_File_close(&fh);//after open, fh has the communicator infoMPI_Finalize();return 0;}
- (1) MPI-IO: 基本函数 open, close, write_shared
- MPI-IO:Open/close/delete
- Linux 文件IO函数(open/close/read/write/lseek)
- 文件IO编程之open和close函数使用实例
- 不带缓存的IO函数open() write() close()
- 笔记3-1: open/close/create 函数
- 高编基本函数open/close,read/write的应用
- open 和 close 函数
- 浅析open、close函数
- open、close以及creat函数
- open/close函数的使用
- open() close() 函数的使用
- open/close函数的使用
- open函数,create函数,close函数
- APUE之open,read,write,close函数应用,制作基本的makefile。
- 基本IO函数的使用(open,write,read)
- 基本IO函数的使用(open,write,read)
- 基本IO函数的使用(open,write,read)
- 第一章 简单工厂模式
- flex学习
- 旧版本Xcode工程在Xcode4.5下真机无法调试问题的解决
- 用NFS启动rootfs的浅度总结
- javadoc,在 Java 的注释上做文章
- (1) MPI-IO: 基本函数 open, close, write_shared
- 半生缘的伤感时尚空间日志发布:残缺的爱,不完美
- Stunnel 加密隧道搭建
- 安装oracle 11g报错
- 如何判断不同格式的文本
- 把Vim改装成一个IDE编程环境
- 关于wince串口接收数据异常
- autoreleasepool
- lazyload.js实现图片异步延迟加载