From 111a3da5058ade0ddcfb01173504a46ff24c8429 Mon Sep 17 00:00:00 2001 From: Augustin Degomme Date: Thu, 18 Apr 2019 22:24:17 +0200 Subject: [PATCH] 32 bits insists of having some timestamps off by 1us ... Hide them. And fix my windows line endings mess. --- src/smpi/bindings/smpi_pmpi_file.cpp | 634 +++++++++--------- src/smpi/include/smpi_file.hpp | 364 +++++----- src/smpi/mpi/smpi_file.cpp | 478 ++++++------- teshsuite/smpi/io-all/io-all.c | 146 ++-- teshsuite/smpi/io-all/io-all.tesh | 104 +-- teshsuite/smpi/io-ordered/io-ordered.c | 90 +-- teshsuite/smpi/io-ordered/io-ordered.tesh | 80 +-- teshsuite/smpi/io-shared/io-shared.c | 130 ++-- teshsuite/smpi/io-shared/io-shared.tesh | 112 ++-- teshsuite/smpi/io-simple-at/io-simple-at.c | 128 ++-- teshsuite/smpi/io-simple-at/io-simple-at.tesh | 64 +- teshsuite/smpi/io-simple/io-simple.c | 132 ++-- teshsuite/smpi/io-simple/io-simple.tesh | 64 +- 13 files changed, 1263 insertions(+), 1263 deletions(-) diff --git a/src/smpi/bindings/smpi_pmpi_file.cpp b/src/smpi/bindings/smpi_pmpi_file.cpp index 6c50a76ed4..cdb35bd739 100644 --- a/src/smpi/bindings/smpi_pmpi_file.cpp +++ b/src/smpi/bindings/smpi_pmpi_file.cpp @@ -1,327 +1,327 @@ -/* Copyright (c) 2007-2019. The SimGrid Team. All rights reserved. */ - -/* This program is free software; you can redistribute it and/or modify it - * under the terms of the license (GNU LGPL) which comes with this package. */ - -#include "private.hpp" -XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(smpi_pmpi); - -#include "smpi_file.hpp" -#include "smpi_datatype.hpp" - - -int PMPI_File_open(MPI_Comm comm, char *filename, int amode, MPI_Info info, MPI_File *fh){ - if (comm == MPI_COMM_NULL) - return MPI_ERR_COMM; - if (filename == nullptr) - return MPI_ERR_FILE; - if (amode < 0) - return MPI_ERR_AMODE; - smpi_bench_end(); - *fh = new simgrid::smpi::File(comm, filename, amode, info); - smpi_bench_begin(); - if (((*fh)->size() == 0 && not (amode & MPI_MODE_CREATE)) || - ((*fh)->size() != 0 && (amode & MPI_MODE_EXCL))){ - delete fh; - return MPI_ERR_AMODE; - } - if(amode & MPI_MODE_APPEND) - (*fh)->seek(0,MPI_SEEK_END); - return MPI_SUCCESS; -} - -int PMPI_File_close(MPI_File *fh){ - if (fh==nullptr) - return MPI_ERR_ARG; - smpi_bench_end(); - int ret = simgrid::smpi::File::close(fh); - *fh = MPI_FILE_NULL; - smpi_bench_begin(); - return ret; -} -#define CHECK_FILE(fh) if(fh==MPI_FILE_NULL) return MPI_ERR_FILE; -#define CHECK_BUFFER(buf, count) if (buf==nullptr && count > 0) return MPI_ERR_BUFFER; -#define CHECK_COUNT(count) if (count < 0) return MPI_ERR_COUNT; -#define CHECK_OFFSET(offset) if (offset < 0) return MPI_ERR_DISP; -#define CHECK_DATATYPE(datatype, count) if (datatype == MPI_DATATYPE_NULL && count > 0) return MPI_ERR_TYPE; -#define CHECK_STATUS(status) if (status == nullptr) return MPI_ERR_ARG; -#define CHECK_FLAGS(fh) if (fh->flags() & MPI_MODE_SEQUENTIAL) return MPI_ERR_AMODE; - -#define PASS_ZEROCOUNT(count) if (count == 0) {\ -status->count=0;\ -return MPI_SUCCESS;\ -} - -int PMPI_File_seek(MPI_File fh, MPI_Offset offset, int whence){ +/* Copyright (c) 2007-2019. The SimGrid Team. All rights reserved. */ + +/* This program is free software; you can redistribute it and/or modify it + * under the terms of the license (GNU LGPL) which comes with this package. */ + +#include "private.hpp" +XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(smpi_pmpi); + +#include "smpi_file.hpp" +#include "smpi_datatype.hpp" + + +int PMPI_File_open(MPI_Comm comm, char *filename, int amode, MPI_Info info, MPI_File *fh){ + if (comm == MPI_COMM_NULL) + return MPI_ERR_COMM; + if (filename == nullptr) + return MPI_ERR_FILE; + if (amode < 0) + return MPI_ERR_AMODE; + smpi_bench_end(); + *fh = new simgrid::smpi::File(comm, filename, amode, info); + smpi_bench_begin(); + if (((*fh)->size() == 0 && not (amode & MPI_MODE_CREATE)) || + ((*fh)->size() != 0 && (amode & MPI_MODE_EXCL))){ + delete fh; + return MPI_ERR_AMODE; + } + if(amode & MPI_MODE_APPEND) + (*fh)->seek(0,MPI_SEEK_END); + return MPI_SUCCESS; +} + +int PMPI_File_close(MPI_File *fh){ + if (fh==nullptr) + return MPI_ERR_ARG; + smpi_bench_end(); + int ret = simgrid::smpi::File::close(fh); + *fh = MPI_FILE_NULL; + smpi_bench_begin(); + return ret; +} +#define CHECK_FILE(fh) if(fh==MPI_FILE_NULL) return MPI_ERR_FILE; +#define CHECK_BUFFER(buf, count) if (buf==nullptr && count > 0) return MPI_ERR_BUFFER; +#define CHECK_COUNT(count) if (count < 0) return MPI_ERR_COUNT; +#define CHECK_OFFSET(offset) if (offset < 0) return MPI_ERR_DISP; +#define CHECK_DATATYPE(datatype, count) if (datatype == MPI_DATATYPE_NULL && count > 0) return MPI_ERR_TYPE; +#define CHECK_STATUS(status) if (status == nullptr) return MPI_ERR_ARG; +#define CHECK_FLAGS(fh) if (fh->flags() & MPI_MODE_SEQUENTIAL) return MPI_ERR_AMODE; + +#define PASS_ZEROCOUNT(count) if (count == 0) {\ +status->count=0;\ +return MPI_SUCCESS;\ +} + +int PMPI_File_seek(MPI_File fh, MPI_Offset offset, int whence){ CHECK_FILE(fh); - smpi_bench_end(); - int ret = fh->seek(offset,whence); - smpi_bench_begin(); - return ret; - -} - -int PMPI_File_seek_shared(MPI_File fh, MPI_Offset offset, int whence){ - CHECK_FILE(fh) - smpi_bench_end(); - int ret = fh->seek_shared(offset,whence); - smpi_bench_begin(); - return ret; - -} - -int PMPI_File_get_position(MPI_File fh, MPI_Offset* offset){ - if (offset==nullptr) - return MPI_ERR_DISP; - smpi_bench_end(); - int ret = fh->get_position(offset); - smpi_bench_begin(); - return ret; -} - -int PMPI_File_get_position_shared(MPI_File fh, MPI_Offset* offset){ - CHECK_FILE(fh) - if (offset==nullptr) - return MPI_ERR_DISP; - smpi_bench_end(); - int ret = fh->get_position_shared(offset); - smpi_bench_begin(); - return ret; -} - -int PMPI_File_read(MPI_File fh, void *buf, int count,MPI_Datatype datatype, MPI_Status *status){ + smpi_bench_end(); + int ret = fh->seek(offset,whence); + smpi_bench_begin(); + return ret; + +} + +int PMPI_File_seek_shared(MPI_File fh, MPI_Offset offset, int whence){ CHECK_FILE(fh) - CHECK_BUFFER(buf, count) - CHECK_COUNT(count) - CHECK_DATATYPE(datatype, count) - CHECK_STATUS(status) - CHECK_FLAGS(fh) - PASS_ZEROCOUNT(count) - smpi_bench_end(); - int rank_traced = simgrid::s4u::this_actor::get_pid(); - TRACE_smpi_comm_in(rank_traced, __func__, new simgrid::instr::CpuTIData("IO - read", static_cast(count*datatype->size()))); - int ret = simgrid::smpi::File::read(fh, buf, count, datatype, status); - TRACE_smpi_comm_out(rank_traced); - smpi_bench_begin(); - return ret; -} - -int PMPI_File_read_shared(MPI_File fh, void *buf, int count,MPI_Datatype datatype, MPI_Status *status){ - CHECK_FILE(fh) - CHECK_BUFFER(buf, count) - CHECK_COUNT(count) - CHECK_DATATYPE(datatype, count) - CHECK_STATUS(status) - CHECK_FLAGS(fh) - PASS_ZEROCOUNT(count) - smpi_bench_end(); - int rank_traced = simgrid::s4u::this_actor::get_pid(); - TRACE_smpi_comm_in(rank_traced, __func__, new simgrid::instr::CpuTIData("IO - read_shared", static_cast(count*datatype->size()))); - int ret = simgrid::smpi::File::read_shared(fh, buf, count, datatype, status); - TRACE_smpi_comm_out(rank_traced); - smpi_bench_begin(); - return ret; -} - -int PMPI_File_write(MPI_File fh, void *buf, int count,MPI_Datatype datatype, MPI_Status *status){ + smpi_bench_end(); + int ret = fh->seek_shared(offset,whence); + smpi_bench_begin(); + return ret; + +} + +int PMPI_File_get_position(MPI_File fh, MPI_Offset* offset){ + if (offset==nullptr) + return MPI_ERR_DISP; + smpi_bench_end(); + int ret = fh->get_position(offset); + smpi_bench_begin(); + return ret; +} + +int PMPI_File_get_position_shared(MPI_File fh, MPI_Offset* offset){ CHECK_FILE(fh) - CHECK_BUFFER(buf, count) - CHECK_COUNT(count) - CHECK_DATATYPE(datatype, count) - CHECK_STATUS(status) - CHECK_FLAGS(fh) - PASS_ZEROCOUNT(count) - smpi_bench_end(); - int rank_traced = simgrid::s4u::this_actor::get_pid(); - TRACE_smpi_comm_in(rank_traced, __func__, new simgrid::instr::CpuTIData("IO - write", static_cast(count*datatype->size()))); - int ret = simgrid::smpi::File::write(fh, buf, count, datatype, status); - TRACE_smpi_comm_out(rank_traced); - smpi_bench_begin(); - return ret; -} - -int PMPI_File_write_shared(MPI_File fh, void *buf, int count,MPI_Datatype datatype, MPI_Status *status){ - CHECK_FILE(fh) - CHECK_BUFFER(buf, count) - CHECK_COUNT(count) - CHECK_DATATYPE(datatype, count) - CHECK_STATUS(status) - CHECK_FLAGS(fh) - PASS_ZEROCOUNT(count) - smpi_bench_end(); - int rank_traced = simgrid::s4u::this_actor::get_pid(); - TRACE_smpi_comm_in(rank_traced, __func__, new simgrid::instr::CpuTIData("IO - write_shared", static_cast(count*datatype->size()))); - int ret = simgrid::smpi::File::write_shared(fh, buf, count, datatype, status); - TRACE_smpi_comm_out(rank_traced); - smpi_bench_begin(); - return ret; -} - -int PMPI_File_read_all(MPI_File fh, void *buf, int count,MPI_Datatype datatype, MPI_Status *status){ + if (offset==nullptr) + return MPI_ERR_DISP; + smpi_bench_end(); + int ret = fh->get_position_shared(offset); + smpi_bench_begin(); + return ret; +} + +int PMPI_File_read(MPI_File fh, void *buf, int count,MPI_Datatype datatype, MPI_Status *status){ CHECK_FILE(fh) - CHECK_BUFFER(buf, count) - CHECK_COUNT(count) - CHECK_DATATYPE(datatype, count) - CHECK_STATUS(status) - CHECK_FLAGS(fh) - smpi_bench_end(); - int rank_traced = simgrid::s4u::this_actor::get_pid(); - TRACE_smpi_comm_in(rank_traced, __func__, new simgrid::instr::CpuTIData("IO - read_all", static_cast(count*datatype->size()))); - int ret = fh->op_all(buf, count, datatype, status); - TRACE_smpi_comm_out(rank_traced); - smpi_bench_begin(); - return ret; -} - -int PMPI_File_read_ordered(MPI_File fh, void *buf, int count,MPI_Datatype datatype, MPI_Status *status){ - CHECK_FILE(fh) - CHECK_BUFFER(buf, count) - CHECK_COUNT(count) - CHECK_DATATYPE(datatype, count) - CHECK_STATUS(status) - CHECK_FLAGS(fh) - smpi_bench_end(); - int rank_traced = simgrid::s4u::this_actor::get_pid(); - TRACE_smpi_comm_in(rank_traced, __func__, new simgrid::instr::CpuTIData("IO - read_ordered", static_cast(count*datatype->size()))); - int ret = simgrid::smpi::File::read_ordered(fh, buf, count, datatype, status); - TRACE_smpi_comm_out(rank_traced); - smpi_bench_begin(); - return ret; -} - -int PMPI_File_write_all(MPI_File fh, void *buf, int count,MPI_Datatype datatype, MPI_Status *status){ + CHECK_BUFFER(buf, count) + CHECK_COUNT(count) + CHECK_DATATYPE(datatype, count) + CHECK_STATUS(status) + CHECK_FLAGS(fh) + PASS_ZEROCOUNT(count) + smpi_bench_end(); + int rank_traced = simgrid::s4u::this_actor::get_pid(); + TRACE_smpi_comm_in(rank_traced, __func__, new simgrid::instr::CpuTIData("IO - read", static_cast(count*datatype->size()))); + int ret = simgrid::smpi::File::read(fh, buf, count, datatype, status); + TRACE_smpi_comm_out(rank_traced); + smpi_bench_begin(); + return ret; +} + +int PMPI_File_read_shared(MPI_File fh, void *buf, int count,MPI_Datatype datatype, MPI_Status *status){ CHECK_FILE(fh) - CHECK_BUFFER(buf, count) - CHECK_COUNT(count) - CHECK_DATATYPE(datatype, count) - CHECK_STATUS(status) - CHECK_FLAGS(fh) - smpi_bench_end(); - int rank_traced = simgrid::s4u::this_actor::get_pid(); - TRACE_smpi_comm_in(rank_traced, __func__, new simgrid::instr::CpuTIData("IO - write_all", static_cast(count*datatype->size()))); - int ret = fh->op_all(buf, count, datatype, status); - TRACE_smpi_comm_out(rank_traced); - smpi_bench_begin(); - return ret; -} - -int PMPI_File_write_ordered(MPI_File fh, void *buf, int count,MPI_Datatype datatype, MPI_Status *status){ - CHECK_FILE(fh) - CHECK_BUFFER(buf, count) - CHECK_COUNT(count) - CHECK_DATATYPE(datatype, count) - CHECK_STATUS(status) - CHECK_FLAGS(fh) - smpi_bench_end(); - int rank_traced = simgrid::s4u::this_actor::get_pid(); - TRACE_smpi_comm_in(rank_traced, __func__, new simgrid::instr::CpuTIData("IO - write_ordered", static_cast(count*datatype->size()))); - int ret = simgrid::smpi::File::write_ordered(fh, buf, count, datatype, status); - TRACE_smpi_comm_out(rank_traced); - smpi_bench_begin(); - return ret; -} - -int PMPI_File_read_at(MPI_File fh, MPI_Offset offset, void *buf, int count,MPI_Datatype datatype, MPI_Status *status){ + CHECK_BUFFER(buf, count) + CHECK_COUNT(count) + CHECK_DATATYPE(datatype, count) + CHECK_STATUS(status) + CHECK_FLAGS(fh) + PASS_ZEROCOUNT(count) + smpi_bench_end(); + int rank_traced = simgrid::s4u::this_actor::get_pid(); + TRACE_smpi_comm_in(rank_traced, __func__, new simgrid::instr::CpuTIData("IO - read_shared", static_cast(count*datatype->size()))); + int ret = simgrid::smpi::File::read_shared(fh, buf, count, datatype, status); + TRACE_smpi_comm_out(rank_traced); + smpi_bench_begin(); + return ret; +} + +int PMPI_File_write(MPI_File fh, void *buf, int count,MPI_Datatype datatype, MPI_Status *status){ CHECK_FILE(fh) - CHECK_BUFFER(buf, count) - CHECK_OFFSET(offset) - CHECK_COUNT(count) - CHECK_DATATYPE(datatype, count) - CHECK_STATUS(status) - CHECK_FLAGS(fh) - PASS_ZEROCOUNT(count); - smpi_bench_end(); - int rank_traced = simgrid::s4u::this_actor::get_pid(); - TRACE_smpi_comm_in(rank_traced, __func__, new simgrid::instr::CpuTIData("IO - read", static_cast(count*datatype->size()))); - int ret = fh->seek(offset,MPI_SEEK_SET); - if(ret!=MPI_SUCCESS) - return ret; - ret = simgrid::smpi::File::read(fh, buf, count, datatype, status); - TRACE_smpi_comm_out(rank_traced); - smpi_bench_begin(); - return ret; -} - -int PMPI_File_read_at_all(MPI_File fh, MPI_Offset offset, void *buf, int count,MPI_Datatype datatype, MPI_Status *status){ + CHECK_BUFFER(buf, count) + CHECK_COUNT(count) + CHECK_DATATYPE(datatype, count) + CHECK_STATUS(status) + CHECK_FLAGS(fh) + PASS_ZEROCOUNT(count) + smpi_bench_end(); + int rank_traced = simgrid::s4u::this_actor::get_pid(); + TRACE_smpi_comm_in(rank_traced, __func__, new simgrid::instr::CpuTIData("IO - write", static_cast(count*datatype->size()))); + int ret = simgrid::smpi::File::write(fh, buf, count, datatype, status); + TRACE_smpi_comm_out(rank_traced); + smpi_bench_begin(); + return ret; +} + +int PMPI_File_write_shared(MPI_File fh, void *buf, int count,MPI_Datatype datatype, MPI_Status *status){ CHECK_FILE(fh) - CHECK_BUFFER(buf, count) - CHECK_OFFSET(offset) - CHECK_COUNT(count) - CHECK_DATATYPE(datatype, count) - CHECK_STATUS(status) - CHECK_FLAGS(fh) - smpi_bench_end(); - int rank_traced = simgrid::s4u::this_actor::get_pid(); - TRACE_smpi_comm_in(rank_traced, __func__, new simgrid::instr::CpuTIData("IO - read_at_all", static_cast(count*datatype->size()))); - int ret = fh->seek(offset,MPI_SEEK_SET); - if(ret!=MPI_SUCCESS) - return ret; - ret = fh->op_all(buf, count, datatype, status); - TRACE_smpi_comm_out(rank_traced); - smpi_bench_begin(); - return ret; -} - -int PMPI_File_write_at(MPI_File fh, MPI_Offset offset, void *buf, int count,MPI_Datatype datatype, MPI_Status *status){ + CHECK_BUFFER(buf, count) + CHECK_COUNT(count) + CHECK_DATATYPE(datatype, count) + CHECK_STATUS(status) + CHECK_FLAGS(fh) + PASS_ZEROCOUNT(count) + smpi_bench_end(); + int rank_traced = simgrid::s4u::this_actor::get_pid(); + TRACE_smpi_comm_in(rank_traced, __func__, new simgrid::instr::CpuTIData("IO - write_shared", static_cast(count*datatype->size()))); + int ret = simgrid::smpi::File::write_shared(fh, buf, count, datatype, status); + TRACE_smpi_comm_out(rank_traced); + smpi_bench_begin(); + return ret; +} + +int PMPI_File_read_all(MPI_File fh, void *buf, int count,MPI_Datatype datatype, MPI_Status *status){ CHECK_FILE(fh) - CHECK_BUFFER(buf, count) - CHECK_OFFSET(offset) - CHECK_COUNT(count) - CHECK_DATATYPE(datatype, count) - CHECK_STATUS(status) - CHECK_FLAGS(fh) - PASS_ZEROCOUNT(count); - smpi_bench_end(); - int rank_traced = simgrid::s4u::this_actor::get_pid(); - TRACE_smpi_comm_in(rank_traced, __func__, new simgrid::instr::CpuTIData("IO - write", static_cast(count*datatype->size()))); - int ret = fh->seek(offset,MPI_SEEK_SET); - if(ret!=MPI_SUCCESS) - return ret; - ret = simgrid::smpi::File::write(fh, buf, count, datatype, status); - TRACE_smpi_comm_out(rank_traced); - smpi_bench_begin(); - return ret; -} - -int PMPI_File_write_at_all(MPI_File fh, MPI_Offset offset, void *buf, int count,MPI_Datatype datatype, MPI_Status *status){ + CHECK_BUFFER(buf, count) + CHECK_COUNT(count) + CHECK_DATATYPE(datatype, count) + CHECK_STATUS(status) + CHECK_FLAGS(fh) + smpi_bench_end(); + int rank_traced = simgrid::s4u::this_actor::get_pid(); + TRACE_smpi_comm_in(rank_traced, __func__, new simgrid::instr::CpuTIData("IO - read_all", static_cast(count*datatype->size()))); + int ret = fh->op_all(buf, count, datatype, status); + TRACE_smpi_comm_out(rank_traced); + smpi_bench_begin(); + return ret; +} + +int PMPI_File_read_ordered(MPI_File fh, void *buf, int count,MPI_Datatype datatype, MPI_Status *status){ CHECK_FILE(fh) - CHECK_BUFFER(buf, count) - CHECK_OFFSET(offset) - CHECK_COUNT(count) - CHECK_DATATYPE(datatype, count) - CHECK_STATUS(status) - CHECK_FLAGS(fh) - smpi_bench_end(); - int rank_traced = simgrid::s4u::this_actor::get_pid(); - TRACE_smpi_comm_in(rank_traced, __func__, new simgrid::instr::CpuTIData("IO - write_at_all", static_cast(count*datatype->size()))); - int ret = fh->seek(offset,MPI_SEEK_SET); - if(ret!=MPI_SUCCESS) - return ret; - ret = fh->op_all(buf, count, datatype, status); - TRACE_smpi_comm_out(rank_traced); - smpi_bench_begin(); - return ret; -} - -int PMPI_File_delete(char *filename, MPI_Info info){ - if (filename == nullptr) - return MPI_ERR_FILE; - smpi_bench_end(); - int ret = simgrid::smpi::File::del(filename, info); - smpi_bench_begin(); - return ret; -} - -int PMPI_File_get_info(MPI_File fh, MPI_Info* info) -{ - CHECK_FILE(fh) - *info = fh->info(); - return MPI_SUCCESS; -} - -int PMPI_File_set_info(MPI_File fh, MPI_Info info) -{ - CHECK_FILE(fh) - fh->set_info(info); - return MPI_SUCCESS; + CHECK_BUFFER(buf, count) + CHECK_COUNT(count) + CHECK_DATATYPE(datatype, count) + CHECK_STATUS(status) + CHECK_FLAGS(fh) + smpi_bench_end(); + int rank_traced = simgrid::s4u::this_actor::get_pid(); + TRACE_smpi_comm_in(rank_traced, __func__, new simgrid::instr::CpuTIData("IO - read_ordered", static_cast(count*datatype->size()))); + int ret = simgrid::smpi::File::read_ordered(fh, buf, count, datatype, status); + TRACE_smpi_comm_out(rank_traced); + smpi_bench_begin(); + return ret; +} + +int PMPI_File_write_all(MPI_File fh, void *buf, int count,MPI_Datatype datatype, MPI_Status *status){ + CHECK_FILE(fh) + CHECK_BUFFER(buf, count) + CHECK_COUNT(count) + CHECK_DATATYPE(datatype, count) + CHECK_STATUS(status) + CHECK_FLAGS(fh) + smpi_bench_end(); + int rank_traced = simgrid::s4u::this_actor::get_pid(); + TRACE_smpi_comm_in(rank_traced, __func__, new simgrid::instr::CpuTIData("IO - write_all", static_cast(count*datatype->size()))); + int ret = fh->op_all(buf, count, datatype, status); + TRACE_smpi_comm_out(rank_traced); + smpi_bench_begin(); + return ret; +} + +int PMPI_File_write_ordered(MPI_File fh, void *buf, int count,MPI_Datatype datatype, MPI_Status *status){ + CHECK_FILE(fh) + CHECK_BUFFER(buf, count) + CHECK_COUNT(count) + CHECK_DATATYPE(datatype, count) + CHECK_STATUS(status) + CHECK_FLAGS(fh) + smpi_bench_end(); + int rank_traced = simgrid::s4u::this_actor::get_pid(); + TRACE_smpi_comm_in(rank_traced, __func__, new simgrid::instr::CpuTIData("IO - write_ordered", static_cast(count*datatype->size()))); + int ret = simgrid::smpi::File::write_ordered(fh, buf, count, datatype, status); + TRACE_smpi_comm_out(rank_traced); + smpi_bench_begin(); + return ret; +} + +int PMPI_File_read_at(MPI_File fh, MPI_Offset offset, void *buf, int count,MPI_Datatype datatype, MPI_Status *status){ + CHECK_FILE(fh) + CHECK_BUFFER(buf, count) + CHECK_OFFSET(offset) + CHECK_COUNT(count) + CHECK_DATATYPE(datatype, count) + CHECK_STATUS(status) + CHECK_FLAGS(fh) + PASS_ZEROCOUNT(count); + smpi_bench_end(); + int rank_traced = simgrid::s4u::this_actor::get_pid(); + TRACE_smpi_comm_in(rank_traced, __func__, new simgrid::instr::CpuTIData("IO - read", static_cast(count*datatype->size()))); + int ret = fh->seek(offset,MPI_SEEK_SET); + if(ret!=MPI_SUCCESS) + return ret; + ret = simgrid::smpi::File::read(fh, buf, count, datatype, status); + TRACE_smpi_comm_out(rank_traced); + smpi_bench_begin(); + return ret; +} + +int PMPI_File_read_at_all(MPI_File fh, MPI_Offset offset, void *buf, int count,MPI_Datatype datatype, MPI_Status *status){ + CHECK_FILE(fh) + CHECK_BUFFER(buf, count) + CHECK_OFFSET(offset) + CHECK_COUNT(count) + CHECK_DATATYPE(datatype, count) + CHECK_STATUS(status) + CHECK_FLAGS(fh) + smpi_bench_end(); + int rank_traced = simgrid::s4u::this_actor::get_pid(); + TRACE_smpi_comm_in(rank_traced, __func__, new simgrid::instr::CpuTIData("IO - read_at_all", static_cast(count*datatype->size()))); + int ret = fh->seek(offset,MPI_SEEK_SET); + if(ret!=MPI_SUCCESS) + return ret; + ret = fh->op_all(buf, count, datatype, status); + TRACE_smpi_comm_out(rank_traced); + smpi_bench_begin(); + return ret; +} + +int PMPI_File_write_at(MPI_File fh, MPI_Offset offset, void *buf, int count,MPI_Datatype datatype, MPI_Status *status){ + CHECK_FILE(fh) + CHECK_BUFFER(buf, count) + CHECK_OFFSET(offset) + CHECK_COUNT(count) + CHECK_DATATYPE(datatype, count) + CHECK_STATUS(status) + CHECK_FLAGS(fh) + PASS_ZEROCOUNT(count); + smpi_bench_end(); + int rank_traced = simgrid::s4u::this_actor::get_pid(); + TRACE_smpi_comm_in(rank_traced, __func__, new simgrid::instr::CpuTIData("IO - write", static_cast(count*datatype->size()))); + int ret = fh->seek(offset,MPI_SEEK_SET); + if(ret!=MPI_SUCCESS) + return ret; + ret = simgrid::smpi::File::write(fh, buf, count, datatype, status); + TRACE_smpi_comm_out(rank_traced); + smpi_bench_begin(); + return ret; +} + +int PMPI_File_write_at_all(MPI_File fh, MPI_Offset offset, void *buf, int count,MPI_Datatype datatype, MPI_Status *status){ + CHECK_FILE(fh) + CHECK_BUFFER(buf, count) + CHECK_OFFSET(offset) + CHECK_COUNT(count) + CHECK_DATATYPE(datatype, count) + CHECK_STATUS(status) + CHECK_FLAGS(fh) + smpi_bench_end(); + int rank_traced = simgrid::s4u::this_actor::get_pid(); + TRACE_smpi_comm_in(rank_traced, __func__, new simgrid::instr::CpuTIData("IO - write_at_all", static_cast(count*datatype->size()))); + int ret = fh->seek(offset,MPI_SEEK_SET); + if(ret!=MPI_SUCCESS) + return ret; + ret = fh->op_all(buf, count, datatype, status); + TRACE_smpi_comm_out(rank_traced); + smpi_bench_begin(); + return ret; +} + +int PMPI_File_delete(char *filename, MPI_Info info){ + if (filename == nullptr) + return MPI_ERR_FILE; + smpi_bench_end(); + int ret = simgrid::smpi::File::del(filename, info); + smpi_bench_begin(); + return ret; +} + +int PMPI_File_get_info(MPI_File fh, MPI_Info* info) +{ + CHECK_FILE(fh) + *info = fh->info(); + return MPI_SUCCESS; +} + +int PMPI_File_set_info(MPI_File fh, MPI_Info info) +{ + CHECK_FILE(fh) + fh->set_info(info); + return MPI_SUCCESS; } \ No newline at end of file diff --git a/src/smpi/include/smpi_file.hpp b/src/smpi/include/smpi_file.hpp index fa3b505125..fe5487f083 100644 --- a/src/smpi/include/smpi_file.hpp +++ b/src/smpi/include/smpi_file.hpp @@ -1,182 +1,182 @@ -/* Copyright (c) 2010-2019. The SimGrid Team. - * All rights reserved. */ - -/* This program is free software; you can redistribute it and/or modify it - * under the terms of the license (GNU LGPL) which comes with this package. */ - -#ifndef SMPI_FILE_HPP_INCLUDED -#define SMPI_FILE_HPP_INCLUDED -#include "simgrid/plugins/file_system.h" -#include "smpi_comm.hpp" -#include "smpi_coll.hpp" -#include "smpi_datatype.hpp" -#include "smpi_info.hpp" -#include - - -namespace simgrid{ -namespace smpi{ -class File{ - MPI_Comm comm_; - int flags_; - simgrid::s4u::File* file_; - MPI_Info info_; - MPI_Offset* shared_file_pointer_; - s4u::MutexPtr shared_mutex_; - MPI_Win win_; - char* list_; - public: - File(MPI_Comm comm, char *filename, int amode, MPI_Info info); - ~File(); - int size(); - int get_position(MPI_Offset* offset); - int get_position_shared(MPI_Offset* offset); - int flags(); - int sync(); - int seek(MPI_Offset offset, int whence); - int seek_shared(MPI_Offset offset, int whence); - MPI_Info info(); - void set_info( MPI_Info info); - static int read(MPI_File fh, void *buf, int count,MPI_Datatype datatype, MPI_Status *status); - static int read_shared(MPI_File fh, void *buf, int count,MPI_Datatype datatype, MPI_Status *status); - static int read_ordered(MPI_File fh, void *buf, int count,MPI_Datatype datatype, MPI_Status *status); - static int write(MPI_File fh, void *buf, int count,MPI_Datatype datatype, MPI_Status *status); - static int write_shared(MPI_File fh, void *buf, int count,MPI_Datatype datatype, MPI_Status *status); - static int write_ordered(MPI_File fh, void *buf, int count,MPI_Datatype datatype, MPI_Status *status); - template int op_all(void *buf, int count,MPI_Datatype datatype, MPI_Status *status); - static int close(MPI_File *fh); - static int del(char *filename, MPI_Info info); -}; - - /* Read_all, Write_all : loosely based on */ - /* @article{Thakur:1996:ETM:245875.245879,*/ - /* author = {Thakur, Rajeev and Choudhary, Alok},*/ - /* title = {An Extended Two-phase Method for Accessing Sections of Out-of-core Arrays},*/ - /* journal = {Sci. Program.},*/ - /* issue_date = {Winter 1996},*/ - /* pages = {301--317},*/ - /* }*/ - template - int File::op_all(void *buf, int count, MPI_Datatype datatype, MPI_Status *status){ - //get min and max offsets from everyone. - int size = comm_->size(); - int rank = comm_-> rank(); - MPI_Offset min_offset = file_->tell(); - MPI_Offset max_offset = (min_offset + count * datatype->size());//cheating, as we don't care about exact data location, we can skip extent - MPI_Offset* min_offsets = xbt_new(MPI_Offset, size); - MPI_Offset* max_offsets = xbt_new(MPI_Offset, size); - simgrid::smpi::Colls::allgather(&min_offset, 1, MPI_OFFSET, min_offsets, 1, MPI_OFFSET, comm_); - simgrid::smpi::Colls::allgather(&max_offset, 1, MPI_OFFSET, max_offsets, 1, MPI_OFFSET, comm_); - MPI_Offset min=min_offset; - MPI_Offset max=max_offset; - MPI_Offset tot= 0; - int empty=1; - for(int i=0;imax) - max=max_offsets[i]; - } - - XBT_DEBUG("my offsets to read : %lld:%lld, global min and max %lld:%lld", min_offset, max_offset, min, max); - if(empty==1){ - status->count=0; - return MPI_SUCCESS; - } - MPI_Offset total = max-min; - if(total==tot && (datatype->flags() & DT_FLAG_CONTIGUOUS)){ - //contiguous. Just have each proc perform its read - status->count=count * datatype->size(); - return T(this,buf,count,datatype, status); - } - - //Interleaved case : How much do I need to read, and whom to send it ? - MPI_Offset my_chunk_start=(max-min+1)/size*rank; - MPI_Offset my_chunk_end=((max-min+1)/size*(rank+1)); - XBT_DEBUG("my chunks to read : %lld:%lld", my_chunk_start, my_chunk_end); - int* send_sizes = xbt_new0(int, size); - int* recv_sizes = xbt_new(int, size); - int* send_disps = xbt_new(int, size); - int* recv_disps = xbt_new(int, size); - int total_sent=0; - for(int i=0;i=min_offsets[i] && my_chunk_start < max_offsets[i])|| - ((my_chunk_end<=max_offsets[i]) && my_chunk_end> min_offsets[i])){ - send_sizes[i]=(std::min(max_offsets[i]-1, my_chunk_end-1)-std::max(min_offsets[i], my_chunk_start)); - //store min and max offest to actually read - min_offset=std::min(min_offset, min_offsets[i]); - send_disps[i]=0;//send_sizes[i]; cheat to avoid issues when send>recv as we use recv buffer - total_sent+=send_sizes[i]; - XBT_DEBUG("will have to send %d bytes to %d", send_sizes[i], i); - } - } - min_offset=std::max(min_offset, my_chunk_start); - - //merge the ranges of every process - std::vector> ranges; - for(int i=0; i> chunks; - chunks.push_back(ranges[0]); - - unsigned int nchunks=0; - unsigned int i=1; - while(i < ranges.size()){ - if(ranges[i].second>chunks[nchunks].second){ - // else range included - ignore - if(ranges[i].first>chunks[nchunks].second){ - //new disjoint range - chunks.push_back(ranges[i]); - nchunks++; - } else { - //merge ranges - chunks[nchunks].second=ranges[i].second; - } - } - i++; - } - //what do I need to read ? - MPI_Offset totreads=0; - for(i=0; i my_chunk_end) - continue; - else - totreads += (std::min(chunks[i].second, my_chunk_end-1)-std::max(chunks[i].first, my_chunk_start)); - } - XBT_DEBUG("will have to access %lld from my chunk", totreads); - - char* sendbuf= static_cast(smpi_get_tmp_sendbuffer(total_sent)); - - if(totreads>0){ - seek(min_offset, MPI_SEEK_SET); - T(this,sendbuf,totreads/datatype->size(),datatype, status); - } - simgrid::smpi::Colls::alltoall(send_sizes, 1, MPI_INT, recv_sizes, 1, MPI_INT, comm_); - int total_recv=0; - for(int i=0;icount=count * datatype->size(); - smpi_free_tmp_buffer(sendbuf); - xbt_free(send_sizes); - xbt_free(recv_sizes); - xbt_free(send_disps); - xbt_free(recv_disps); - xbt_free(min_offsets); - xbt_free(max_offsets); - return MPI_SUCCESS; - } -} -} - -#endif +/* Copyright (c) 2010-2019. The SimGrid Team. + * All rights reserved. */ + +/* This program is free software; you can redistribute it and/or modify it + * under the terms of the license (GNU LGPL) which comes with this package. */ + +#ifndef SMPI_FILE_HPP_INCLUDED +#define SMPI_FILE_HPP_INCLUDED +#include "simgrid/plugins/file_system.h" +#include "smpi_comm.hpp" +#include "smpi_coll.hpp" +#include "smpi_datatype.hpp" +#include "smpi_info.hpp" +#include + + +namespace simgrid{ +namespace smpi{ +class File{ + MPI_Comm comm_; + int flags_; + simgrid::s4u::File* file_; + MPI_Info info_; + MPI_Offset* shared_file_pointer_; + s4u::MutexPtr shared_mutex_; + MPI_Win win_; + char* list_; + public: + File(MPI_Comm comm, char *filename, int amode, MPI_Info info); + ~File(); + int size(); + int get_position(MPI_Offset* offset); + int get_position_shared(MPI_Offset* offset); + int flags(); + int sync(); + int seek(MPI_Offset offset, int whence); + int seek_shared(MPI_Offset offset, int whence); + MPI_Info info(); + void set_info( MPI_Info info); + static int read(MPI_File fh, void *buf, int count,MPI_Datatype datatype, MPI_Status *status); + static int read_shared(MPI_File fh, void *buf, int count,MPI_Datatype datatype, MPI_Status *status); + static int read_ordered(MPI_File fh, void *buf, int count,MPI_Datatype datatype, MPI_Status *status); + static int write(MPI_File fh, void *buf, int count,MPI_Datatype datatype, MPI_Status *status); + static int write_shared(MPI_File fh, void *buf, int count,MPI_Datatype datatype, MPI_Status *status); + static int write_ordered(MPI_File fh, void *buf, int count,MPI_Datatype datatype, MPI_Status *status); + template int op_all(void *buf, int count,MPI_Datatype datatype, MPI_Status *status); + static int close(MPI_File *fh); + static int del(char *filename, MPI_Info info); +}; + + /* Read_all, Write_all : loosely based on */ + /* @article{Thakur:1996:ETM:245875.245879,*/ + /* author = {Thakur, Rajeev and Choudhary, Alok},*/ + /* title = {An Extended Two-phase Method for Accessing Sections of Out-of-core Arrays},*/ + /* journal = {Sci. Program.},*/ + /* issue_date = {Winter 1996},*/ + /* pages = {301--317},*/ + /* }*/ + template + int File::op_all(void *buf, int count, MPI_Datatype datatype, MPI_Status *status){ + //get min and max offsets from everyone. + int size = comm_->size(); + int rank = comm_-> rank(); + MPI_Offset min_offset = file_->tell(); + MPI_Offset max_offset = (min_offset + count * datatype->size());//cheating, as we don't care about exact data location, we can skip extent + MPI_Offset* min_offsets = xbt_new(MPI_Offset, size); + MPI_Offset* max_offsets = xbt_new(MPI_Offset, size); + simgrid::smpi::Colls::allgather(&min_offset, 1, MPI_OFFSET, min_offsets, 1, MPI_OFFSET, comm_); + simgrid::smpi::Colls::allgather(&max_offset, 1, MPI_OFFSET, max_offsets, 1, MPI_OFFSET, comm_); + MPI_Offset min=min_offset; + MPI_Offset max=max_offset; + MPI_Offset tot= 0; + int empty=1; + for(int i=0;imax) + max=max_offsets[i]; + } + + XBT_DEBUG("my offsets to read : %lld:%lld, global min and max %lld:%lld", min_offset, max_offset, min, max); + if(empty==1){ + status->count=0; + return MPI_SUCCESS; + } + MPI_Offset total = max-min; + if(total==tot && (datatype->flags() & DT_FLAG_CONTIGUOUS)){ + //contiguous. Just have each proc perform its read + status->count=count * datatype->size(); + return T(this,buf,count,datatype, status); + } + + //Interleaved case : How much do I need to read, and whom to send it ? + MPI_Offset my_chunk_start=(max-min+1)/size*rank; + MPI_Offset my_chunk_end=((max-min+1)/size*(rank+1)); + XBT_DEBUG("my chunks to read : %lld:%lld", my_chunk_start, my_chunk_end); + int* send_sizes = xbt_new0(int, size); + int* recv_sizes = xbt_new(int, size); + int* send_disps = xbt_new(int, size); + int* recv_disps = xbt_new(int, size); + int total_sent=0; + for(int i=0;i=min_offsets[i] && my_chunk_start < max_offsets[i])|| + ((my_chunk_end<=max_offsets[i]) && my_chunk_end> min_offsets[i])){ + send_sizes[i]=(std::min(max_offsets[i]-1, my_chunk_end-1)-std::max(min_offsets[i], my_chunk_start)); + //store min and max offest to actually read + min_offset=std::min(min_offset, min_offsets[i]); + send_disps[i]=0;//send_sizes[i]; cheat to avoid issues when send>recv as we use recv buffer + total_sent+=send_sizes[i]; + XBT_DEBUG("will have to send %d bytes to %d", send_sizes[i], i); + } + } + min_offset=std::max(min_offset, my_chunk_start); + + //merge the ranges of every process + std::vector> ranges; + for(int i=0; i> chunks; + chunks.push_back(ranges[0]); + + unsigned int nchunks=0; + unsigned int i=1; + while(i < ranges.size()){ + if(ranges[i].second>chunks[nchunks].second){ + // else range included - ignore + if(ranges[i].first>chunks[nchunks].second){ + //new disjoint range + chunks.push_back(ranges[i]); + nchunks++; + } else { + //merge ranges + chunks[nchunks].second=ranges[i].second; + } + } + i++; + } + //what do I need to read ? + MPI_Offset totreads=0; + for(i=0; i my_chunk_end) + continue; + else + totreads += (std::min(chunks[i].second, my_chunk_end-1)-std::max(chunks[i].first, my_chunk_start)); + } + XBT_DEBUG("will have to access %lld from my chunk", totreads); + + char* sendbuf= static_cast(smpi_get_tmp_sendbuffer(total_sent)); + + if(totreads>0){ + seek(min_offset, MPI_SEEK_SET); + T(this,sendbuf,totreads/datatype->size(),datatype, status); + } + simgrid::smpi::Colls::alltoall(send_sizes, 1, MPI_INT, recv_sizes, 1, MPI_INT, comm_); + int total_recv=0; + for(int i=0;icount=count * datatype->size(); + smpi_free_tmp_buffer(sendbuf); + xbt_free(send_sizes); + xbt_free(recv_sizes); + xbt_free(send_disps); + xbt_free(recv_disps); + xbt_free(min_offsets); + xbt_free(max_offsets); + return MPI_SUCCESS; + } +} +} + +#endif diff --git a/src/smpi/mpi/smpi_file.cpp b/src/smpi/mpi/smpi_file.cpp index 46937ceed6..abf21aaa23 100644 --- a/src/smpi/mpi/smpi_file.cpp +++ b/src/smpi/mpi/smpi_file.cpp @@ -1,239 +1,239 @@ -/* Copyright (c) 2007-2019. The SimGrid Team. All rights reserved. */ - -/* This program is free software; you can redistribute it and/or modify it - * under the terms of the license (GNU LGPL) which comes with this package. */ -#include "private.hpp" - -#include "smpi_comm.hpp" -#include "smpi_coll.hpp" -#include "smpi_datatype.hpp" -#include "smpi_info.hpp" -#include "smpi_win.hpp" -#include "smpi_request.hpp" - -//setup here, because we have templates in smpi_file we want to log -XBT_LOG_NEW_DEFAULT_SUBCATEGORY(smpi_io, smpi, "Logging specific to SMPI (RMA operations)"); - -#include "smpi_file.hpp" -#include "smpi_status.hpp" -#include "simgrid/plugins/file_system.h" - -#define FP_SIZE sizeof(MPI_Offset) - - -namespace simgrid{ -namespace smpi{ - - File::File(MPI_Comm comm, char *filename, int amode, MPI_Info info): comm_(comm), flags_(amode), info_(info) { - file_= new simgrid::s4u::File(filename, nullptr); - list_=nullptr; - if (comm_->rank() == 0) { - int size= comm_->size() + FP_SIZE; - list_ = new char[size]; - memset(list_, 0, size); - shared_file_pointer_ = new MPI_Offset[1]; - shared_mutex_ = s4u::Mutex::create(); - *shared_file_pointer_ = 0; - win_=new Win(list_, size, 1, MPI_INFO_NULL, comm_); - }else{ - win_=new Win(list_, 0, 1, MPI_INFO_NULL, comm_); - } - simgrid::smpi::Colls::bcast(&shared_file_pointer_, 1, MPI_AINT, 0, comm); - simgrid::smpi::Colls::bcast(&shared_mutex_, 1, MPI_AINT, 0, comm); - if(comm_->rank() != 0) - intrusive_ptr_add_ref(&*shared_mutex_); - } - - File::~File(){ - delete file_; - } - - int File::close(MPI_File *fh){ - XBT_DEBUG("Closing MPI_File %s", (*fh)->file_->get_path()); - (*fh)->sync(); - if((*fh)->flags() & MPI_MODE_DELETE_ON_CLOSE) - (*fh)->file_->unlink(); - delete (*fh); - return MPI_SUCCESS; - } - - int File::del(char *filename, MPI_Info info){ - //get the file with MPI_MODE_DELETE_ON_CLOSE and then close it - File* f = new File(MPI_COMM_SELF,filename,MPI_MODE_DELETE_ON_CLOSE|MPI_MODE_RDWR, nullptr); - close(&f); - return MPI_SUCCESS; - } - - int File::get_position(MPI_Offset* offset){ - *offset=file_->tell(); - return MPI_SUCCESS; - } - - int File::get_position_shared(MPI_Offset* offset){ - shared_mutex_->lock(); - *offset=*shared_file_pointer_; - shared_mutex_->unlock(); - return MPI_SUCCESS; - } - - int File::seek(MPI_Offset offset, int whence){ - switch(whence){ - case(MPI_SEEK_SET): - XBT_VERB("Seeking in MPI_File %s, setting offset %lld", file_->get_path(), offset); - file_->seek(offset,SEEK_SET); - break; - case(MPI_SEEK_CUR): - XBT_VERB("Seeking in MPI_File %s, current offset + %lld", file_->get_path(), offset); - file_->seek(offset,SEEK_CUR); - break; - case(MPI_SEEK_END): - XBT_VERB("Seeking in MPI_File %s, end offset + %lld", file_->get_path(), offset); - file_->seek(offset,SEEK_END); - break; - default: - return MPI_ERR_FILE; - } - return MPI_SUCCESS; - } - - int File::seek_shared(MPI_Offset offset, int whence){ - shared_mutex_->lock(); - seek(offset,whence); - *shared_file_pointer_=offset; - shared_mutex_->unlock(); - return MPI_SUCCESS; - } - - int File::read(MPI_File fh, void *buf, int count, MPI_Datatype datatype, MPI_Status *status){ - //get position first as we may be doing non contiguous reads and it will probably be updated badly - MPI_Offset position = fh->file_->tell(); - MPI_Offset movesize = datatype->get_extent()*count; - MPI_Offset readsize = datatype->size()*count; - XBT_DEBUG("Position before read in MPI_File %s : %llu",fh->file_->get_path(),fh->file_->tell()); - MPI_Offset read = fh->file_->read(readsize); - XBT_VERB("Read in MPI_File %s, %lld bytes read, readsize %lld bytes, movesize %lld", fh->file_->get_path(), read, readsize, movesize); - if(readsize!=movesize){ - fh->file_->seek(position+movesize, SEEK_SET); - } - XBT_VERB("Position after read in MPI_File %s : %llu",fh->file_->get_path(), fh->file_->tell()); - status->count=count*datatype->size(); - return MPI_SUCCESS; - } - - /*Ordered and Shared Versions, with RMA-based locks : Based on the model described in :*/ - /* @InProceedings{10.1007/11557265_15,*/ - /* author="Latham, Robert and Ross, Robert and Thakur, Rajeev and Toonen, Brian",*/ - /* title="Implementing MPI-IO Shared File Pointers Without File System Support",*/ - /* booktitle="Recent Advances in Parallel Virtual Machine and Message Passing Interface",*/ - /* year="2005",*/ - /* publisher="Springer Berlin Heidelberg",*/ - /* address="Berlin, Heidelberg",*/ - /* pages="84--93"*/ - /* }*/ - int File::read_shared(MPI_File fh, void *buf, int count, MPI_Datatype datatype, MPI_Status *status){ - fh->shared_mutex_->lock(); - fh->seek(*(fh->shared_file_pointer_),MPI_SEEK_SET); - read(fh, buf, count, datatype, status); - *(fh->shared_file_pointer_)=fh->file_->tell(); - fh->shared_mutex_->unlock(); - return MPI_SUCCESS; - } - - int File::read_ordered(MPI_File fh, void *buf, int count, MPI_Datatype datatype, MPI_Status *status){ - //0 needs to get the shared pointer value - MPI_Offset val; - if(fh->comm_->rank()==0){ - val=*(fh->shared_file_pointer_); - }else{ - val=count*datatype->size(); - } - - MPI_Offset result; - simgrid::smpi::Colls::scan(&val, &result, 1, MPI_OFFSET, MPI_SUM, fh->comm_); - fh->seek(result, MPI_SEEK_SET); - int ret = fh->op_all(buf, count, datatype, status); - if(fh->comm_->rank()==fh->comm_->size()-1){ - fh->shared_mutex_->lock(); - *(fh->shared_file_pointer_)=fh->file_->tell(); - fh->shared_mutex_->unlock(); - } - char c; - simgrid::smpi::Colls::bcast(&c, 1, MPI_BYTE, fh->comm_->size()-1, fh->comm_); - return ret; - } - - int File::write(MPI_File fh, void *buf, int count, MPI_Datatype datatype, MPI_Status *status){ - //get position first as we may be doing non contiguous reads and it will probably be updated badly - MPI_Offset position = fh->file_->tell(); - MPI_Offset movesize = datatype->get_extent()*count; - MPI_Offset writesize = datatype->size()*count; - XBT_DEBUG("Position before write in MPI_File %s : %llu",fh->file_->get_path(),fh->file_->tell()); - MPI_Offset write = fh->file_->write(writesize); - XBT_VERB("Write in MPI_File %s, %lld bytes written, readsize %lld bytes, movesize %lld", fh->file_->get_path(), write, writesize, movesize); - if(writesize!=movesize){ - fh->file_->seek(position+movesize, SEEK_SET); - } - XBT_VERB("Position after write in MPI_File %s : %llu",fh->file_->get_path(), fh->file_->tell()); - status->count=count*datatype->size(); - return MPI_SUCCESS; - } - - int File::write_shared(MPI_File fh, void *buf, int count, MPI_Datatype datatype, MPI_Status *status){ - fh->shared_mutex_->lock(); - fh->seek(*(fh->shared_file_pointer_),MPI_SEEK_SET); - write(fh, buf, count, datatype, status); - *(fh->shared_file_pointer_)=fh->file_->tell(); - fh->shared_mutex_->unlock(); - return MPI_SUCCESS; - } - - int File::write_ordered(MPI_File fh, void *buf, int count, MPI_Datatype datatype, MPI_Status *status){ - //0 needs to get the shared pointer value - MPI_Offset val; - if(fh->comm_->rank()==0){ - val=*(fh->shared_file_pointer_); - }else{ - val=count*datatype->size(); - } - MPI_Offset result; - simgrid::smpi::Colls::scan(&val, &result, 1, MPI_OFFSET, MPI_SUM, fh->comm_); - fh->seek(result, MPI_SEEK_SET); - int ret = fh->op_all(buf, count, datatype, status); - if(fh->comm_->rank()==fh->comm_->size()-1){ - fh->shared_mutex_->lock(); - *(fh->shared_file_pointer_)=fh->file_->tell(); - fh->shared_mutex_->unlock(); - } - char c; - simgrid::smpi::Colls::bcast(&c, 1, MPI_BYTE, fh->comm_->size()-1, fh->comm_); - return ret; - } - - int File::size(){ - return file_->size(); - } - - int File::flags(){ - return flags_; - } - - int File::sync(){ - //no idea - return simgrid::smpi::Colls::barrier(comm_); - } - -MPI_Info File::info(){ - if(info_== MPI_INFO_NULL) - info_ = new Info(); - info_->ref(); - return info_; -} - -void File::set_info(MPI_Info info){ - if(info_!= MPI_INFO_NULL) - info->ref(); - info_=info; -} - -} -} +/* Copyright (c) 2007-2019. The SimGrid Team. All rights reserved. */ + +/* This program is free software; you can redistribute it and/or modify it + * under the terms of the license (GNU LGPL) which comes with this package. */ +#include "private.hpp" + +#include "smpi_comm.hpp" +#include "smpi_coll.hpp" +#include "smpi_datatype.hpp" +#include "smpi_info.hpp" +#include "smpi_win.hpp" +#include "smpi_request.hpp" + +//setup here, because we have templates in smpi_file we want to log +XBT_LOG_NEW_DEFAULT_SUBCATEGORY(smpi_io, smpi, "Logging specific to SMPI (RMA operations)"); + +#include "smpi_file.hpp" +#include "smpi_status.hpp" +#include "simgrid/plugins/file_system.h" + +#define FP_SIZE sizeof(MPI_Offset) + + +namespace simgrid{ +namespace smpi{ + + File::File(MPI_Comm comm, char *filename, int amode, MPI_Info info): comm_(comm), flags_(amode), info_(info) { + file_= new simgrid::s4u::File(filename, nullptr); + list_=nullptr; + if (comm_->rank() == 0) { + int size= comm_->size() + FP_SIZE; + list_ = new char[size]; + memset(list_, 0, size); + shared_file_pointer_ = new MPI_Offset[1]; + shared_mutex_ = s4u::Mutex::create(); + *shared_file_pointer_ = 0; + win_=new Win(list_, size, 1, MPI_INFO_NULL, comm_); + }else{ + win_=new Win(list_, 0, 1, MPI_INFO_NULL, comm_); + } + simgrid::smpi::Colls::bcast(&shared_file_pointer_, 1, MPI_AINT, 0, comm); + simgrid::smpi::Colls::bcast(&shared_mutex_, 1, MPI_AINT, 0, comm); + if(comm_->rank() != 0) + intrusive_ptr_add_ref(&*shared_mutex_); + } + + File::~File(){ + delete file_; + } + + int File::close(MPI_File *fh){ + XBT_DEBUG("Closing MPI_File %s", (*fh)->file_->get_path()); + (*fh)->sync(); + if((*fh)->flags() & MPI_MODE_DELETE_ON_CLOSE) + (*fh)->file_->unlink(); + delete (*fh); + return MPI_SUCCESS; + } + + int File::del(char *filename, MPI_Info info){ + //get the file with MPI_MODE_DELETE_ON_CLOSE and then close it + File* f = new File(MPI_COMM_SELF,filename,MPI_MODE_DELETE_ON_CLOSE|MPI_MODE_RDWR, nullptr); + close(&f); + return MPI_SUCCESS; + } + + int File::get_position(MPI_Offset* offset){ + *offset=file_->tell(); + return MPI_SUCCESS; + } + + int File::get_position_shared(MPI_Offset* offset){ + shared_mutex_->lock(); + *offset=*shared_file_pointer_; + shared_mutex_->unlock(); + return MPI_SUCCESS; + } + + int File::seek(MPI_Offset offset, int whence){ + switch(whence){ + case(MPI_SEEK_SET): + XBT_VERB("Seeking in MPI_File %s, setting offset %lld", file_->get_path(), offset); + file_->seek(offset,SEEK_SET); + break; + case(MPI_SEEK_CUR): + XBT_VERB("Seeking in MPI_File %s, current offset + %lld", file_->get_path(), offset); + file_->seek(offset,SEEK_CUR); + break; + case(MPI_SEEK_END): + XBT_VERB("Seeking in MPI_File %s, end offset + %lld", file_->get_path(), offset); + file_->seek(offset,SEEK_END); + break; + default: + return MPI_ERR_FILE; + } + return MPI_SUCCESS; + } + + int File::seek_shared(MPI_Offset offset, int whence){ + shared_mutex_->lock(); + seek(offset,whence); + *shared_file_pointer_=offset; + shared_mutex_->unlock(); + return MPI_SUCCESS; + } + + int File::read(MPI_File fh, void *buf, int count, MPI_Datatype datatype, MPI_Status *status){ + //get position first as we may be doing non contiguous reads and it will probably be updated badly + MPI_Offset position = fh->file_->tell(); + MPI_Offset movesize = datatype->get_extent()*count; + MPI_Offset readsize = datatype->size()*count; + XBT_DEBUG("Position before read in MPI_File %s : %llu",fh->file_->get_path(),fh->file_->tell()); + MPI_Offset read = fh->file_->read(readsize); + XBT_VERB("Read in MPI_File %s, %lld bytes read, readsize %lld bytes, movesize %lld", fh->file_->get_path(), read, readsize, movesize); + if(readsize!=movesize){ + fh->file_->seek(position+movesize, SEEK_SET); + } + XBT_VERB("Position after read in MPI_File %s : %llu",fh->file_->get_path(), fh->file_->tell()); + status->count=count*datatype->size(); + return MPI_SUCCESS; + } + + /*Ordered and Shared Versions, with RMA-based locks : Based on the model described in :*/ + /* @InProceedings{10.1007/11557265_15,*/ + /* author="Latham, Robert and Ross, Robert and Thakur, Rajeev and Toonen, Brian",*/ + /* title="Implementing MPI-IO Shared File Pointers Without File System Support",*/ + /* booktitle="Recent Advances in Parallel Virtual Machine and Message Passing Interface",*/ + /* year="2005",*/ + /* publisher="Springer Berlin Heidelberg",*/ + /* address="Berlin, Heidelberg",*/ + /* pages="84--93"*/ + /* }*/ + int File::read_shared(MPI_File fh, void *buf, int count, MPI_Datatype datatype, MPI_Status *status){ + fh->shared_mutex_->lock(); + fh->seek(*(fh->shared_file_pointer_),MPI_SEEK_SET); + read(fh, buf, count, datatype, status); + *(fh->shared_file_pointer_)=fh->file_->tell(); + fh->shared_mutex_->unlock(); + return MPI_SUCCESS; + } + + int File::read_ordered(MPI_File fh, void *buf, int count, MPI_Datatype datatype, MPI_Status *status){ + //0 needs to get the shared pointer value + MPI_Offset val; + if(fh->comm_->rank()==0){ + val=*(fh->shared_file_pointer_); + }else{ + val=count*datatype->size(); + } + + MPI_Offset result; + simgrid::smpi::Colls::scan(&val, &result, 1, MPI_OFFSET, MPI_SUM, fh->comm_); + fh->seek(result, MPI_SEEK_SET); + int ret = fh->op_all(buf, count, datatype, status); + if(fh->comm_->rank()==fh->comm_->size()-1){ + fh->shared_mutex_->lock(); + *(fh->shared_file_pointer_)=fh->file_->tell(); + fh->shared_mutex_->unlock(); + } + char c; + simgrid::smpi::Colls::bcast(&c, 1, MPI_BYTE, fh->comm_->size()-1, fh->comm_); + return ret; + } + + int File::write(MPI_File fh, void *buf, int count, MPI_Datatype datatype, MPI_Status *status){ + //get position first as we may be doing non contiguous reads and it will probably be updated badly + MPI_Offset position = fh->file_->tell(); + MPI_Offset movesize = datatype->get_extent()*count; + MPI_Offset writesize = datatype->size()*count; + XBT_DEBUG("Position before write in MPI_File %s : %llu",fh->file_->get_path(),fh->file_->tell()); + MPI_Offset write = fh->file_->write(writesize); + XBT_VERB("Write in MPI_File %s, %lld bytes written, readsize %lld bytes, movesize %lld", fh->file_->get_path(), write, writesize, movesize); + if(writesize!=movesize){ + fh->file_->seek(position+movesize, SEEK_SET); + } + XBT_VERB("Position after write in MPI_File %s : %llu",fh->file_->get_path(), fh->file_->tell()); + status->count=count*datatype->size(); + return MPI_SUCCESS; + } + + int File::write_shared(MPI_File fh, void *buf, int count, MPI_Datatype datatype, MPI_Status *status){ + fh->shared_mutex_->lock(); + fh->seek(*(fh->shared_file_pointer_),MPI_SEEK_SET); + write(fh, buf, count, datatype, status); + *(fh->shared_file_pointer_)=fh->file_->tell(); + fh->shared_mutex_->unlock(); + return MPI_SUCCESS; + } + + int File::write_ordered(MPI_File fh, void *buf, int count, MPI_Datatype datatype, MPI_Status *status){ + //0 needs to get the shared pointer value + MPI_Offset val; + if(fh->comm_->rank()==0){ + val=*(fh->shared_file_pointer_); + }else{ + val=count*datatype->size(); + } + MPI_Offset result; + simgrid::smpi::Colls::scan(&val, &result, 1, MPI_OFFSET, MPI_SUM, fh->comm_); + fh->seek(result, MPI_SEEK_SET); + int ret = fh->op_all(buf, count, datatype, status); + if(fh->comm_->rank()==fh->comm_->size()-1){ + fh->shared_mutex_->lock(); + *(fh->shared_file_pointer_)=fh->file_->tell(); + fh->shared_mutex_->unlock(); + } + char c; + simgrid::smpi::Colls::bcast(&c, 1, MPI_BYTE, fh->comm_->size()-1, fh->comm_); + return ret; + } + + int File::size(){ + return file_->size(); + } + + int File::flags(){ + return flags_; + } + + int File::sync(){ + //no idea + return simgrid::smpi::Colls::barrier(comm_); + } + +MPI_Info File::info(){ + if(info_== MPI_INFO_NULL) + info_ = new Info(); + info_->ref(); + return info_; +} + +void File::set_info(MPI_Info info){ + if(info_!= MPI_INFO_NULL) + info->ref(); + info_=info; +} + +} +} diff --git a/teshsuite/smpi/io-all/io-all.c b/teshsuite/smpi/io-all/io-all.c index 0f97937747..9d3506c86a 100644 --- a/teshsuite/smpi/io-all/io-all.c +++ b/teshsuite/smpi/io-all/io-all.c @@ -1,74 +1,74 @@ -#include "mpi.h" -#include -#include -#include -#include - -/* Test reading and writing zero bytes (set status correctly) */ - -int main( int argc, char *argv[] ) -{ - int errs = 0; - int size, rank, i, *buf, count; - MPI_File fh; - MPI_Comm comm; - MPI_Status status; - - MPI_Init( &argc, &argv ); - - comm = MPI_COMM_WORLD; - MPI_File_open( comm, (char*)"/scratch/lib/libsimgrid.so.3.6.2", MPI_MODE_RDWR | MPI_MODE_CREATE | MPI_MODE_DELETE_ON_CLOSE, MPI_INFO_NULL, &fh ); - MPI_Comm_size( comm, &size ); - MPI_Comm_rank( comm, &rank ); - buf = (int *)malloc( 10 * sizeof(int) ); - buf[0] = rank; - - /* Write to file */ - MPI_File_seek( fh, sizeof(int)*rank, MPI_SEEK_SET ); - MPI_File_write_all( fh, buf, 1, MPI_INT, &status ); - MPI_Get_count( &status, MPI_INT, &count ); - if (count != 1) { - errs++; - fprintf( stderr, "Wrong count (%d) on write\n", count );fflush(stderr); - } - /* Write to file, overlapping */ - MPI_File_seek( fh, sizeof(int)*rank, MPI_SEEK_SET ); - MPI_File_write_all( fh, buf, 10, MPI_INT, &status ); - MPI_Get_count( &status, MPI_INT, &count ); - if (count != 10) { - errs++; - fprintf( stderr, "Wrong count (%d) on write\n", count );fflush(stderr); - } - /* Read nothing (check status) */ - memset( &status, 0xff, sizeof(MPI_Status) ); - MPI_File_read_all( fh, buf, 0, MPI_INT, &status ); - MPI_Get_count( &status, MPI_INT, &count ); - if (count != 0) { - errs++; - fprintf( stderr, "Count not zero (%d) on read\n", count );fflush(stderr); - } - - /* Write nothing (check status) */ - memset( &status, 0xff, sizeof(MPI_Status) ); - MPI_File_write_all( fh, buf, 0, MPI_INT, &status ); - if (count != 0) { - errs++; - fprintf( stderr, "Count not zero (%d) on write\n", count );fflush(stderr); - } - - MPI_Barrier( comm ); - - MPI_File_seek( fh, sizeof(int)*rank, MPI_SEEK_SET ); - for (i=0; i +#include +#include +#include + +/* Test reading and writing zero bytes (set status correctly) */ + +int main( int argc, char *argv[] ) +{ + int errs = 0; + int size, rank, i, *buf, count; + MPI_File fh; + MPI_Comm comm; + MPI_Status status; + + MPI_Init( &argc, &argv ); + + comm = MPI_COMM_WORLD; + MPI_File_open( comm, (char*)"/scratch/lib/libsimgrid.so.3.6.2", MPI_MODE_RDWR | MPI_MODE_CREATE | MPI_MODE_DELETE_ON_CLOSE, MPI_INFO_NULL, &fh ); + MPI_Comm_size( comm, &size ); + MPI_Comm_rank( comm, &rank ); + buf = (int *)malloc( 10 * sizeof(int) ); + buf[0] = rank; + + /* Write to file */ + MPI_File_seek( fh, sizeof(int)*rank, MPI_SEEK_SET ); + MPI_File_write_all( fh, buf, 1, MPI_INT, &status ); + MPI_Get_count( &status, MPI_INT, &count ); + if (count != 1) { + errs++; + fprintf( stderr, "Wrong count (%d) on write\n", count );fflush(stderr); + } + /* Write to file, overlapping */ + MPI_File_seek( fh, sizeof(int)*rank, MPI_SEEK_SET ); + MPI_File_write_all( fh, buf, 10, MPI_INT, &status ); + MPI_Get_count( &status, MPI_INT, &count ); + if (count != 10) { + errs++; + fprintf( stderr, "Wrong count (%d) on write\n", count );fflush(stderr); + } + /* Read nothing (check status) */ + memset( &status, 0xff, sizeof(MPI_Status) ); + MPI_File_read_all( fh, buf, 0, MPI_INT, &status ); + MPI_Get_count( &status, MPI_INT, &count ); + if (count != 0) { + errs++; + fprintf( stderr, "Count not zero (%d) on read\n", count );fflush(stderr); + } + + /* Write nothing (check status) */ + memset( &status, 0xff, sizeof(MPI_Status) ); + MPI_File_write_all( fh, buf, 0, MPI_INT, &status ); + if (count != 0) { + errs++; + fprintf( stderr, "Count not zero (%d) on write\n", count );fflush(stderr); + } + + MPI_Barrier( comm ); + + MPI_File_seek( fh, sizeof(int)*rank, MPI_SEEK_SET ); + for (i=0; i You requested to use 4 ranks, but there is only 2 processes in your hostfile... -> [rank 0] -> bob -> [rank 1] -> carl -> [rank 2] -> bob -> [rank 3] -> carl -> [ 0.000282] (0@bob) Seeking in MPI_File /scratch/lib/libsimgrid.so.3.6.2, setting offset 0 -> [ 0.000358] (2@bob) Seeking in MPI_File /scratch/lib/libsimgrid.so.3.6.2, setting offset 8 -> [ 0.000534] (3@carl) Seeking in MPI_File /scratch/lib/libsimgrid.so.3.6.2, setting offset 12 -> [ 0.000534] (1@carl) Seeking in MPI_File /scratch/lib/libsimgrid.so.3.6.2, setting offset 4 -> [ 0.000737] (3@carl) Write in MPI_File /scratch/lib/libsimgrid.so.3.6.2, 4 bytes written, readsize 4 bytes, movesize 4 -> [ 0.000737] (3@carl) Position after write in MPI_File /scratch/lib/libsimgrid.so.3.6.2 : 16 -> [ 0.000737] (3@carl) Seeking in MPI_File /scratch/lib/libsimgrid.so.3.6.2, setting offset 12 -> [ 0.000737] (1@carl) Write in MPI_File /scratch/lib/libsimgrid.so.3.6.2, 4 bytes written, readsize 4 bytes, movesize 4 -> [ 0.000737] (1@carl) Position after write in MPI_File /scratch/lib/libsimgrid.so.3.6.2 : 8 -> [ 0.000737] (1@carl) Seeking in MPI_File /scratch/lib/libsimgrid.so.3.6.2, setting offset 4 -> [ 0.000838] (2@bob) Write in MPI_File /scratch/lib/libsimgrid.so.3.6.2, 4 bytes written, readsize 4 bytes, movesize 4 -> [ 0.000838] (2@bob) Position after write in MPI_File /scratch/lib/libsimgrid.so.3.6.2 : 12 -> [ 0.000838] (2@bob) Seeking in MPI_File /scratch/lib/libsimgrid.so.3.6.2, setting offset 8 -> [ 0.000838] (0@bob) Write in MPI_File /scratch/lib/libsimgrid.so.3.6.2, 4 bytes written, readsize 4 bytes, movesize 4 -> [ 0.000838] (0@bob) Position after write in MPI_File /scratch/lib/libsimgrid.so.3.6.2 : 4 -> [ 0.000838] (0@bob) Seeking in MPI_File /scratch/lib/libsimgrid.so.3.6.2, setting offset 0 -> [ 0.001040] (3@carl) Seeking in MPI_File /scratch/lib/libsimgrid.so.3.6.2, setting offset 39 -> [ 0.001040] (2@bob) Seeking in MPI_File /scratch/lib/libsimgrid.so.3.6.2, setting offset 26 -> [ 0.001040] (0@bob) Seeking in MPI_File /scratch/lib/libsimgrid.so.3.6.2, setting offset 0 -> [ 0.001040] (1@carl) Seeking in MPI_File /scratch/lib/libsimgrid.so.3.6.2, setting offset 13 -> [ 0.001041] (3@carl) Write in MPI_File /scratch/lib/libsimgrid.so.3.6.2, 12 bytes written, readsize 12 bytes, movesize 12 -> [ 0.001041] (3@carl) Position after write in MPI_File /scratch/lib/libsimgrid.so.3.6.2 : 51 -> [ 0.001041] (1@carl) Write in MPI_File /scratch/lib/libsimgrid.so.3.6.2, 12 bytes written, readsize 12 bytes, movesize 12 -> [ 0.001041] (1@carl) Position after write in MPI_File /scratch/lib/libsimgrid.so.3.6.2 : 25 -> [ 0.001141] (0@bob) Write in MPI_File /scratch/lib/libsimgrid.so.3.6.2, 12 bytes written, readsize 12 bytes, movesize 12 -> [ 0.001141] (0@bob) Position after write in MPI_File /scratch/lib/libsimgrid.so.3.6.2 : 12 -> [ 0.001141] (2@bob) Write in MPI_File /scratch/lib/libsimgrid.so.3.6.2, 12 bytes written, readsize 12 bytes, movesize 12 -> [ 0.001141] (2@bob) Position after write in MPI_File /scratch/lib/libsimgrid.so.3.6.2 : 38 -> [ 0.001799] (0@bob) Seeking in MPI_File /scratch/lib/libsimgrid.so.3.6.2, setting offset 0 -> [ 0.001814] (2@bob) Seeking in MPI_File /scratch/lib/libsimgrid.so.3.6.2, setting offset 8 -> [ 0.001849] (3@carl) Seeking in MPI_File /scratch/lib/libsimgrid.so.3.6.2, setting offset 12 -> [ 0.001849] (1@carl) Seeking in MPI_File /scratch/lib/libsimgrid.so.3.6.2, setting offset 4 -> [ 0.002052] (0@bob) Seeking in MPI_File /scratch/lib/libsimgrid.so.3.6.2, setting offset 0 -> [ 0.002052] (2@bob) Seeking in MPI_File /scratch/lib/libsimgrid.so.3.6.2, setting offset 26 -> [ 0.002052] (3@carl) Seeking in MPI_File /scratch/lib/libsimgrid.so.3.6.2, setting offset 39 -> [ 0.002052] (1@carl) Seeking in MPI_File /scratch/lib/libsimgrid.so.3.6.2, setting offset 13 -> [ 0.002052] (3@carl) Read in MPI_File /scratch/lib/libsimgrid.so.3.6.2, 12 bytes read, readsize 12 bytes, movesize 12 -> [ 0.002052] (3@carl) Position after read in MPI_File /scratch/lib/libsimgrid.so.3.6.2 : 51 -> [ 0.002052] (1@carl) Read in MPI_File /scratch/lib/libsimgrid.so.3.6.2, 12 bytes read, readsize 12 bytes, movesize 12 -> [ 0.002052] (1@carl) Position after read in MPI_File /scratch/lib/libsimgrid.so.3.6.2 : 25 -> [ 0.002153] (2@bob) Read in MPI_File /scratch/lib/libsimgrid.so.3.6.2, 12 bytes read, readsize 12 bytes, movesize 12 -> [ 0.002153] (2@bob) Position after read in MPI_File /scratch/lib/libsimgrid.so.3.6.2 : 38 -> [ 0.002153] (0@bob) Read in MPI_File /scratch/lib/libsimgrid.so.3.6.2, 12 bytes read, readsize 12 bytes, movesize 12 -> [ 0.002153] (0@bob) Position after read in MPI_File /scratch/lib/libsimgrid.so.3.6.2 : 12 +# Test for MPI_File_read and MPI_File_write +! output sort +$ ${bindir:=.}/../../../smpi_script/bin/smpirun -map -hostfile ../hostfile_io -platform ../../../examples/platforms/storage/remote_io.xml -np 4 --log=xbt_cfg.thres:critical --log=smpi_kernel.thres:warning --log=smpi_mpi.thres:error --log=smpi_io.thres:verbose "--log=root.fmt:(%P@%h)%e%m%n" --cfg=smpi/simulate-computation:0 ${bindir:=.}/io-all +> You requested to use 4 ranks, but there is only 2 processes in your hostfile... +> [rank 0] -> bob +> [rank 1] -> carl +> [rank 2] -> bob +> [rank 3] -> carl +> (0@bob) Seeking in MPI_File /scratch/lib/libsimgrid.so.3.6.2, setting offset 0 +> (2@bob) Seeking in MPI_File /scratch/lib/libsimgrid.so.3.6.2, setting offset 8 +> (3@carl) Seeking in MPI_File /scratch/lib/libsimgrid.so.3.6.2, setting offset 12 +> (1@carl) Seeking in MPI_File /scratch/lib/libsimgrid.so.3.6.2, setting offset 4 +> (3@carl) Write in MPI_File /scratch/lib/libsimgrid.so.3.6.2, 4 bytes written, readsize 4 bytes, movesize 4 +> (3@carl) Position after write in MPI_File /scratch/lib/libsimgrid.so.3.6.2 : 16 +> (3@carl) Seeking in MPI_File /scratch/lib/libsimgrid.so.3.6.2, setting offset 12 +> (1@carl) Write in MPI_File /scratch/lib/libsimgrid.so.3.6.2, 4 bytes written, readsize 4 bytes, movesize 4 +> (1@carl) Position after write in MPI_File /scratch/lib/libsimgrid.so.3.6.2 : 8 +> (1@carl) Seeking in MPI_File /scratch/lib/libsimgrid.so.3.6.2, setting offset 4 +> (2@bob) Write in MPI_File /scratch/lib/libsimgrid.so.3.6.2, 4 bytes written, readsize 4 bytes, movesize 4 +> (2@bob) Position after write in MPI_File /scratch/lib/libsimgrid.so.3.6.2 : 12 +> (2@bob) Seeking in MPI_File /scratch/lib/libsimgrid.so.3.6.2, setting offset 8 +> (0@bob) Write in MPI_File /scratch/lib/libsimgrid.so.3.6.2, 4 bytes written, readsize 4 bytes, movesize 4 +> (0@bob) Position after write in MPI_File /scratch/lib/libsimgrid.so.3.6.2 : 4 +> (0@bob) Seeking in MPI_File /scratch/lib/libsimgrid.so.3.6.2, setting offset 0 +> (3@carl) Seeking in MPI_File /scratch/lib/libsimgrid.so.3.6.2, setting offset 39 +> (2@bob) Seeking in MPI_File /scratch/lib/libsimgrid.so.3.6.2, setting offset 26 +> (0@bob) Seeking in MPI_File /scratch/lib/libsimgrid.so.3.6.2, setting offset 0 +> (1@carl) Seeking in MPI_File /scratch/lib/libsimgrid.so.3.6.2, setting offset 13 +> (3@carl) Write in MPI_File /scratch/lib/libsimgrid.so.3.6.2, 12 bytes written, readsize 12 bytes, movesize 12 +> (3@carl) Position after write in MPI_File /scratch/lib/libsimgrid.so.3.6.2 : 51 +> (1@carl) Write in MPI_File /scratch/lib/libsimgrid.so.3.6.2, 12 bytes written, readsize 12 bytes, movesize 12 +> (1@carl) Position after write in MPI_File /scratch/lib/libsimgrid.so.3.6.2 : 25 +> (0@bob) Write in MPI_File /scratch/lib/libsimgrid.so.3.6.2, 12 bytes written, readsize 12 bytes, movesize 12 +> (0@bob) Position after write in MPI_File /scratch/lib/libsimgrid.so.3.6.2 : 12 +> (2@bob) Write in MPI_File /scratch/lib/libsimgrid.so.3.6.2, 12 bytes written, readsize 12 bytes, movesize 12 +> (2@bob) Position after write in MPI_File /scratch/lib/libsimgrid.so.3.6.2 : 38 +> (0@bob) Seeking in MPI_File /scratch/lib/libsimgrid.so.3.6.2, setting offset 0 +> (2@bob) Seeking in MPI_File /scratch/lib/libsimgrid.so.3.6.2, setting offset 8 +> (3@carl) Seeking in MPI_File /scratch/lib/libsimgrid.so.3.6.2, setting offset 12 +> (1@carl) Seeking in MPI_File /scratch/lib/libsimgrid.so.3.6.2, setting offset 4 +> (0@bob) Seeking in MPI_File /scratch/lib/libsimgrid.so.3.6.2, setting offset 0 +> (2@bob) Seeking in MPI_File /scratch/lib/libsimgrid.so.3.6.2, setting offset 26 +> (3@carl) Seeking in MPI_File /scratch/lib/libsimgrid.so.3.6.2, setting offset 39 +> (1@carl) Seeking in MPI_File /scratch/lib/libsimgrid.so.3.6.2, setting offset 13 +> (3@carl) Read in MPI_File /scratch/lib/libsimgrid.so.3.6.2, 12 bytes read, readsize 12 bytes, movesize 12 +> (3@carl) Position after read in MPI_File /scratch/lib/libsimgrid.so.3.6.2 : 51 +> (1@carl) Read in MPI_File /scratch/lib/libsimgrid.so.3.6.2, 12 bytes read, readsize 12 bytes, movesize 12 +> (1@carl) Position after read in MPI_File /scratch/lib/libsimgrid.so.3.6.2 : 25 +> (2@bob) Read in MPI_File /scratch/lib/libsimgrid.so.3.6.2, 12 bytes read, readsize 12 bytes, movesize 12 +> (2@bob) Position after read in MPI_File /scratch/lib/libsimgrid.so.3.6.2 : 38 +> (0@bob) Read in MPI_File /scratch/lib/libsimgrid.so.3.6.2, 12 bytes read, readsize 12 bytes, movesize 12 +> (0@bob) Position after read in MPI_File /scratch/lib/libsimgrid.so.3.6.2 : 12 diff --git a/teshsuite/smpi/io-ordered/io-ordered.c b/teshsuite/smpi/io-ordered/io-ordered.c index 7fae204439..14bbfe6018 100644 --- a/teshsuite/smpi/io-ordered/io-ordered.c +++ b/teshsuite/smpi/io-ordered/io-ordered.c @@ -1,46 +1,46 @@ -#include "mpi.h" -#include -#include -#include -#include - -/* Test reading and writing zero bytes (set status correctly) */ - -int main( int argc, char *argv[] ) -{ - int errs = 0; - int size, rank, i, *buf, count; - MPI_File fh; - MPI_Comm comm; - MPI_Status status; - - MPI_Init( &argc, &argv ); - - comm = MPI_COMM_WORLD; - MPI_File_open( comm, (char*)"/scratch/lib/libsimgrid.so.3.6.2", MPI_MODE_RDWR | MPI_MODE_CREATE | MPI_MODE_DELETE_ON_CLOSE, MPI_INFO_NULL, &fh ); - MPI_Comm_size( comm, &size ); - MPI_Comm_rank( comm, &rank ); - buf = (int *)malloc( 10* sizeof(int) ); - buf[0] = rank; - - /* Write to file */ - MPI_File_write_ordered( fh, buf, 10, MPI_INT, &status ); - MPI_Get_count( &status, MPI_INT, &count ); - if (count != 10) { - errs++; - fprintf( stderr, "Wrong count (%d) on write-ordered\n", count );fflush(stderr); - } - MPI_Barrier( comm ); - MPI_File_seek_shared( fh, 0, MPI_SEEK_SET ); - for (i=0; i +#include +#include +#include + +/* Test reading and writing zero bytes (set status correctly) */ + +int main( int argc, char *argv[] ) +{ + int errs = 0; + int size, rank, i, *buf, count; + MPI_File fh; + MPI_Comm comm; + MPI_Status status; + + MPI_Init( &argc, &argv ); + + comm = MPI_COMM_WORLD; + MPI_File_open( comm, (char*)"/scratch/lib/libsimgrid.so.3.6.2", MPI_MODE_RDWR | MPI_MODE_CREATE | MPI_MODE_DELETE_ON_CLOSE, MPI_INFO_NULL, &fh ); + MPI_Comm_size( comm, &size ); + MPI_Comm_rank( comm, &rank ); + buf = (int *)malloc( 10* sizeof(int) ); + buf[0] = rank; + + /* Write to file */ + MPI_File_write_ordered( fh, buf, 10, MPI_INT, &status ); + MPI_Get_count( &status, MPI_INT, &count ); + if (count != 10) { + errs++; + fprintf( stderr, "Wrong count (%d) on write-ordered\n", count );fflush(stderr); + } + MPI_Barrier( comm ); + MPI_File_seek_shared( fh, 0, MPI_SEEK_SET ); + for (i=0; i You requested to use 4 ranks, but there is only 2 processes in your hostfile... -> [rank 0] -> bob -> [rank 1] -> carl -> [rank 2] -> bob -> [rank 3] -> carl -> [ 0.000282] (0@bob) Seeking in MPI_File /scratch/lib/libsimgrid.so.3.6.2, setting offset 0 -> [ 0.000635] (2@bob) Seeking in MPI_File /scratch/lib/libsimgrid.so.3.6.2, setting offset 80 -> [ 0.000635] (1@carl) Seeking in MPI_File /scratch/lib/libsimgrid.so.3.6.2, setting offset 40 -> [ 0.000635] (3@carl) Seeking in MPI_File /scratch/lib/libsimgrid.so.3.6.2, setting offset 120 -> [ 0.000839] (3@carl) Write in MPI_File /scratch/lib/libsimgrid.so.3.6.2, 40 bytes written, readsize 40 bytes, movesize 40 -> [ 0.000839] (3@carl) Position after write in MPI_File /scratch/lib/libsimgrid.so.3.6.2 : 160 -> [ 0.000839] (1@carl) Write in MPI_File /scratch/lib/libsimgrid.so.3.6.2, 40 bytes written, readsize 40 bytes, movesize 40 -> [ 0.000839] (1@carl) Position after write in MPI_File /scratch/lib/libsimgrid.so.3.6.2 : 80 -> [ 0.000940] (2@bob) Write in MPI_File /scratch/lib/libsimgrid.so.3.6.2, 40 bytes written, readsize 40 bytes, movesize 40 -> [ 0.000940] (2@bob) Position after write in MPI_File /scratch/lib/libsimgrid.so.3.6.2 : 120 -> [ 0.000940] (0@bob) Write in MPI_File /scratch/lib/libsimgrid.so.3.6.2, 40 bytes written, readsize 40 bytes, movesize 40 -> [ 0.000940] (0@bob) Position after write in MPI_File /scratch/lib/libsimgrid.so.3.6.2 : 40 -> [ 0.001091] (0@bob) Seeking in MPI_File /scratch/lib/libsimgrid.so.3.6.2, setting offset 0 -> [ 0.001091] (0@bob) Seeking in MPI_File /scratch/lib/libsimgrid.so.3.6.2, setting offset 0 -> [ 0.001106] (2@bob) Seeking in MPI_File /scratch/lib/libsimgrid.so.3.6.2, setting offset 0 -> [ 0.001141] (3@carl) Seeking in MPI_File /scratch/lib/libsimgrid.so.3.6.2, setting offset 0 -> [ 0.001141] (1@carl) Seeking in MPI_File /scratch/lib/libsimgrid.so.3.6.2, setting offset 0 -> [ 0.001242] (2@bob) Seeking in MPI_File /scratch/lib/libsimgrid.so.3.6.2, setting offset 80 -> [ 0.001242] (1@carl) Seeking in MPI_File /scratch/lib/libsimgrid.so.3.6.2, setting offset 40 -> [ 0.001242] (3@carl) Seeking in MPI_File /scratch/lib/libsimgrid.so.3.6.2, setting offset 120 -> [ 0.001446] (3@carl) Read in MPI_File /scratch/lib/libsimgrid.so.3.6.2, 40 bytes read, readsize 40 bytes, movesize 40 -> [ 0.001446] (3@carl) Position after read in MPI_File /scratch/lib/libsimgrid.so.3.6.2 : 160 -> [ 0.001446] (1@carl) Read in MPI_File /scratch/lib/libsimgrid.so.3.6.2, 40 bytes read, readsize 40 bytes, movesize 40 -> [ 0.001446] (1@carl) Position after read in MPI_File /scratch/lib/libsimgrid.so.3.6.2 : 80 -> [ 0.001548] (2@bob) Read in MPI_File /scratch/lib/libsimgrid.so.3.6.2, 40 bytes read, readsize 40 bytes, movesize 40 -> [ 0.001548] (2@bob) Position after read in MPI_File /scratch/lib/libsimgrid.so.3.6.2 : 120 -> [ 0.001548] (0@bob) Read in MPI_File /scratch/lib/libsimgrid.so.3.6.2, 40 bytes read, readsize 40 bytes, movesize 40 -> [ 0.001548] (0@bob) Position after read in MPI_File /scratch/lib/libsimgrid.so.3.6.2 : 40 -> [ 0.001699] (0@bob) Seeking in MPI_File /scratch/lib/libsimgrid.so.3.6.2, setting offset 0 -> [ 0.001714] (2@bob) Seeking in MPI_File /scratch/lib/libsimgrid.so.3.6.2, setting offset 0 -> [ 0.001749] (3@carl) Seeking in MPI_File /scratch/lib/libsimgrid.so.3.6.2, setting offset 0 -> [ 0.001749] (1@carl) Seeking in MPI_File /scratch/lib/libsimgrid.so.3.6.2, setting offset 0 +# Test for MPI_File_read and MPI_File_write +! output sort +$ ${bindir:=.}/../../../smpi_script/bin/smpirun -map -hostfile ../hostfile_io -platform ../../../examples/platforms/storage/remote_io.xml -np 4 --log=xbt_cfg.thres:critical --log=smpi_kernel.thres:warning --log=smpi_mpi.thres:error --log=smpi_io.thres:verbose "--log=root.fmt:(%P@%h)%e%m%n" --cfg=smpi/simulate-computation:0 ${bindir:=.}/io-ordered +> You requested to use 4 ranks, but there is only 2 processes in your hostfile... +> [rank 0] -> bob +> [rank 1] -> carl +> [rank 2] -> bob +> [rank 3] -> carl +> (0@bob) Seeking in MPI_File /scratch/lib/libsimgrid.so.3.6.2, setting offset 0 +> (2@bob) Seeking in MPI_File /scratch/lib/libsimgrid.so.3.6.2, setting offset 80 +> (1@carl) Seeking in MPI_File /scratch/lib/libsimgrid.so.3.6.2, setting offset 40 +> (3@carl) Seeking in MPI_File /scratch/lib/libsimgrid.so.3.6.2, setting offset 120 +> (3@carl) Write in MPI_File /scratch/lib/libsimgrid.so.3.6.2, 40 bytes written, readsize 40 bytes, movesize 40 +> (3@carl) Position after write in MPI_File /scratch/lib/libsimgrid.so.3.6.2 : 160 +> (1@carl) Write in MPI_File /scratch/lib/libsimgrid.so.3.6.2, 40 bytes written, readsize 40 bytes, movesize 40 +> (1@carl) Position after write in MPI_File /scratch/lib/libsimgrid.so.3.6.2 : 80 +> (2@bob) Write in MPI_File /scratch/lib/libsimgrid.so.3.6.2, 40 bytes written, readsize 40 bytes, movesize 40 +> (2@bob) Position after write in MPI_File /scratch/lib/libsimgrid.so.3.6.2 : 120 +> (0@bob) Write in MPI_File /scratch/lib/libsimgrid.so.3.6.2, 40 bytes written, readsize 40 bytes, movesize 40 +> (0@bob) Position after write in MPI_File /scratch/lib/libsimgrid.so.3.6.2 : 40 +> (0@bob) Seeking in MPI_File /scratch/lib/libsimgrid.so.3.6.2, setting offset 0 +> (0@bob) Seeking in MPI_File /scratch/lib/libsimgrid.so.3.6.2, setting offset 0 +> (2@bob) Seeking in MPI_File /scratch/lib/libsimgrid.so.3.6.2, setting offset 0 +> (3@carl) Seeking in MPI_File /scratch/lib/libsimgrid.so.3.6.2, setting offset 0 +> (1@carl) Seeking in MPI_File /scratch/lib/libsimgrid.so.3.6.2, setting offset 0 +> (2@bob) Seeking in MPI_File /scratch/lib/libsimgrid.so.3.6.2, setting offset 80 +> (1@carl) Seeking in MPI_File /scratch/lib/libsimgrid.so.3.6.2, setting offset 40 +> (3@carl) Seeking in MPI_File /scratch/lib/libsimgrid.so.3.6.2, setting offset 120 +> (3@carl) Read in MPI_File /scratch/lib/libsimgrid.so.3.6.2, 40 bytes read, readsize 40 bytes, movesize 40 +> (3@carl) Position after read in MPI_File /scratch/lib/libsimgrid.so.3.6.2 : 160 +> (1@carl) Read in MPI_File /scratch/lib/libsimgrid.so.3.6.2, 40 bytes read, readsize 40 bytes, movesize 40 +> (1@carl) Position after read in MPI_File /scratch/lib/libsimgrid.so.3.6.2 : 80 +> (2@bob) Read in MPI_File /scratch/lib/libsimgrid.so.3.6.2, 40 bytes read, readsize 40 bytes, movesize 40 +> (2@bob) Position after read in MPI_File /scratch/lib/libsimgrid.so.3.6.2 : 120 +> (0@bob) Read in MPI_File /scratch/lib/libsimgrid.so.3.6.2, 40 bytes read, readsize 40 bytes, movesize 40 +> (0@bob) Position after read in MPI_File /scratch/lib/libsimgrid.so.3.6.2 : 40 +> (0@bob) Seeking in MPI_File /scratch/lib/libsimgrid.so.3.6.2, setting offset 0 +> (2@bob) Seeking in MPI_File /scratch/lib/libsimgrid.so.3.6.2, setting offset 0 +> (3@carl) Seeking in MPI_File /scratch/lib/libsimgrid.so.3.6.2, setting offset 0 +> (1@carl) Seeking in MPI_File /scratch/lib/libsimgrid.so.3.6.2, setting offset 0 diff --git a/teshsuite/smpi/io-shared/io-shared.c b/teshsuite/smpi/io-shared/io-shared.c index d83c8baad0..9b1b5b143a 100644 --- a/teshsuite/smpi/io-shared/io-shared.c +++ b/teshsuite/smpi/io-shared/io-shared.c @@ -1,66 +1,66 @@ -#include "mpi.h" -#include -#include -#include -#include - -/* Test reading and writing zero bytes (set status correctly) */ - -int main( int argc, char *argv[] ) -{ - int errs = 0; - int size, rank, i, *buf, count; - MPI_File fh; - MPI_Comm comm; - MPI_Status status; - - MPI_Init( &argc, &argv ); - - comm = MPI_COMM_WORLD; - MPI_File_open( comm, (char*)"/scratch/lib/libsimgrid.so.3.6.2", MPI_MODE_RDWR | MPI_MODE_CREATE | MPI_MODE_DELETE_ON_CLOSE, MPI_INFO_NULL, &fh ); - MPI_Comm_size( comm, &size ); - MPI_Comm_rank( comm, &rank ); - buf = (int *)malloc( 10+size * sizeof(int) ); - buf[0] = rank; - - /* Write nothing (check status) */ - memset( &status, 0xff, sizeof(MPI_Status) ); - MPI_File_write( fh, buf, 0, MPI_INT, &status ); - MPI_Get_count( &status, MPI_INT, &count ); - if (count != 0) { - errs++; - fprintf( stderr, "Count not zero (%d) on write\n", count );fflush(stderr); - } - - MPI_Barrier( comm ); - MPI_File_seek_shared( fh, 0, MPI_SEEK_SET ); - for (i=0; i +#include +#include +#include + +/* Test reading and writing zero bytes (set status correctly) */ + +int main( int argc, char *argv[] ) +{ + int errs = 0; + int size, rank, i, *buf, count; + MPI_File fh; + MPI_Comm comm; + MPI_Status status; + + MPI_Init( &argc, &argv ); + + comm = MPI_COMM_WORLD; + MPI_File_open( comm, (char*)"/scratch/lib/libsimgrid.so.3.6.2", MPI_MODE_RDWR | MPI_MODE_CREATE | MPI_MODE_DELETE_ON_CLOSE, MPI_INFO_NULL, &fh ); + MPI_Comm_size( comm, &size ); + MPI_Comm_rank( comm, &rank ); + buf = (int *)malloc( 10+size * sizeof(int) ); + buf[0] = rank; + + /* Write nothing (check status) */ + memset( &status, 0xff, sizeof(MPI_Status) ); + MPI_File_write( fh, buf, 0, MPI_INT, &status ); + MPI_Get_count( &status, MPI_INT, &count ); + if (count != 0) { + errs++; + fprintf( stderr, "Count not zero (%d) on write\n", count );fflush(stderr); + } + + MPI_Barrier( comm ); + MPI_File_seek_shared( fh, 0, MPI_SEEK_SET ); + for (i=0; i You requested to use 4 ranks, but there is only 2 processes in your hostfile... -> [rank 0] -> bob -> [rank 1] -> carl -> [rank 2] -> bob -> [rank 3] -> carl -> [ 0.000584] (0@bob) Seeking in MPI_File /scratch/lib/libsimgrid.so.3.6.2, setting offset 0 -> [ 0.000584] (0@bob) Seeking in MPI_File /scratch/lib/libsimgrid.so.3.6.2, setting offset 0 -> [ 0.000599] (2@bob) Seeking in MPI_File /scratch/lib/libsimgrid.so.3.6.2, setting offset 0 -> [ 0.000634] (3@carl) Seeking in MPI_File /scratch/lib/libsimgrid.so.3.6.2, setting offset 0 -> [ 0.000634] (1@carl) Seeking in MPI_File /scratch/lib/libsimgrid.so.3.6.2, setting offset 0 -> [ 0.000735] (2@bob) Seeking in MPI_File /scratch/lib/libsimgrid.so.3.6.2, setting offset 80 -> [ 0.000735] (1@carl) Seeking in MPI_File /scratch/lib/libsimgrid.so.3.6.2, setting offset 40 -> [ 0.000735] (3@carl) Seeking in MPI_File /scratch/lib/libsimgrid.so.3.6.2, setting offset 120 -> [ 0.000939] (3@carl) Read in MPI_File /scratch/lib/libsimgrid.so.3.6.2, 40 bytes read, readsize 40 bytes, movesize 40 -> [ 0.000939] (3@carl) Position after read in MPI_File /scratch/lib/libsimgrid.so.3.6.2 : 160 -> [ 0.000939] (1@carl) Read in MPI_File /scratch/lib/libsimgrid.so.3.6.2, 40 bytes read, readsize 40 bytes, movesize 40 -> [ 0.000939] (1@carl) Position after read in MPI_File /scratch/lib/libsimgrid.so.3.6.2 : 80 -> [ 0.001041] (2@bob) Read in MPI_File /scratch/lib/libsimgrid.so.3.6.2, 40 bytes read, readsize 40 bytes, movesize 40 -> [ 0.001041] (2@bob) Position after read in MPI_File /scratch/lib/libsimgrid.so.3.6.2 : 120 -> [ 0.001041] (0@bob) Read in MPI_File /scratch/lib/libsimgrid.so.3.6.2, 40 bytes read, readsize 40 bytes, movesize 40 -> [ 0.001041] (0@bob) Position after read in MPI_File /scratch/lib/libsimgrid.so.3.6.2 : 40 -> [ 0.001192] (0@bob) Seeking in MPI_File /scratch/lib/libsimgrid.so.3.6.2, setting offset 0 -> [ 0.001192] (0@bob) Seeking in MPI_File /scratch/lib/libsimgrid.so.3.6.2, setting offset 0 -> [ 0.001292] (0@bob) Read in MPI_File /scratch/lib/libsimgrid.so.3.6.2, 4 bytes read, readsize 4 bytes, movesize 4 -> [ 0.001292] (0@bob) Position after read in MPI_File /scratch/lib/libsimgrid.so.3.6.2 : 4 -> [ 0.001292] (2@bob) Seeking in MPI_File /scratch/lib/libsimgrid.so.3.6.2, setting offset 0 -> [ 0.001292] (3@carl) Seeking in MPI_File /scratch/lib/libsimgrid.so.3.6.2, setting offset 0 -> [ 0.001292] (1@carl) Seeking in MPI_File /scratch/lib/libsimgrid.so.3.6.2, setting offset 0 -> [ 0.001292] (2@bob) Seeking in MPI_File /scratch/lib/libsimgrid.so.3.6.2, setting offset 0 -> [ 0.001393] (2@bob) Read in MPI_File /scratch/lib/libsimgrid.so.3.6.2, 4 bytes read, readsize 4 bytes, movesize 4 -> [ 0.001393] (2@bob) Position after read in MPI_File /scratch/lib/libsimgrid.so.3.6.2 : 4 -> [ 0.001393] (3@carl) Seeking in MPI_File /scratch/lib/libsimgrid.so.3.6.2, setting offset 4 -> [ 0.001393] (3@carl) Read in MPI_File /scratch/lib/libsimgrid.so.3.6.2, 4 bytes read, readsize 4 bytes, movesize 4 -> [ 0.001393] (3@carl) Position after read in MPI_File /scratch/lib/libsimgrid.so.3.6.2 : 8 -> [ 0.001393] (1@carl) Seeking in MPI_File /scratch/lib/libsimgrid.so.3.6.2, setting offset 8 -> [ 0.001393] (1@carl) Read in MPI_File /scratch/lib/libsimgrid.so.3.6.2, 4 bytes read, readsize 4 bytes, movesize 4 -> [ 0.001393] (1@carl) Position after read in MPI_File /scratch/lib/libsimgrid.so.3.6.2 : 12 -> [ 0.001443] (0@bob) Seeking in MPI_File /scratch/lib/libsimgrid.so.3.6.2, setting offset 0 -> [ 0.001443] (0@bob) Seeking in MPI_File /scratch/lib/libsimgrid.so.3.6.2, setting offset 0 -> [ 0.001544] (0@bob) Write in MPI_File /scratch/lib/libsimgrid.so.3.6.2, 4 bytes written, readsize 4 bytes, movesize 4 -> [ 0.001544] (0@bob) Position after write in MPI_File /scratch/lib/libsimgrid.so.3.6.2 : 4 -> [ 0.001544] (2@bob) Seeking in MPI_File /scratch/lib/libsimgrid.so.3.6.2, setting offset 0 -> [ 0.001544] (3@carl) Seeking in MPI_File /scratch/lib/libsimgrid.so.3.6.2, setting offset 0 -> [ 0.001544] (1@carl) Seeking in MPI_File /scratch/lib/libsimgrid.so.3.6.2, setting offset 0 -> [ 0.001544] (2@bob) Seeking in MPI_File /scratch/lib/libsimgrid.so.3.6.2, setting offset 0 -> [ 0.001645] (2@bob) Write in MPI_File /scratch/lib/libsimgrid.so.3.6.2, 4 bytes written, readsize 4 bytes, movesize 4 -> [ 0.001645] (2@bob) Position after write in MPI_File /scratch/lib/libsimgrid.so.3.6.2 : 4 -> [ 0.001645] (3@carl) Seeking in MPI_File /scratch/lib/libsimgrid.so.3.6.2, setting offset 4 -> [ 0.001645] (3@carl) Write in MPI_File /scratch/lib/libsimgrid.so.3.6.2, 4 bytes written, readsize 4 bytes, movesize 4 -> [ 0.001645] (3@carl) Position after write in MPI_File /scratch/lib/libsimgrid.so.3.6.2 : 8 -> [ 0.001645] (1@carl) Seeking in MPI_File /scratch/lib/libsimgrid.so.3.6.2, setting offset 8 -> [ 0.001645] (1@carl) Write in MPI_File /scratch/lib/libsimgrid.so.3.6.2, 4 bytes written, readsize 4 bytes, movesize 4 -> [ 0.001645] (1@carl) Position after write in MPI_File /scratch/lib/libsimgrid.so.3.6.2 : 12 +# Test for MPI_File_read and MPI_File_write +! output sort +$ ${bindir:=.}/../../../smpi_script/bin/smpirun -map -hostfile ../hostfile_io -platform ../../../examples/platforms/storage/remote_io.xml -np 4 --log=xbt_cfg.thres:critical --log=smpi_kernel.thres:warning --log=smpi_mpi.thres:error --log=smpi_io.thres:verbose "--log=root.fmt:(%P@%h)%e%m%n" --cfg=smpi/simulate-computation:0 ${bindir:=.}/io-shared +> You requested to use 4 ranks, but there is only 2 processes in your hostfile... +> [rank 0] -> bob +> [rank 1] -> carl +> [rank 2] -> bob +> [rank 3] -> carl +> (0@bob) Seeking in MPI_File /scratch/lib/libsimgrid.so.3.6.2, setting offset 0 +> (0@bob) Seeking in MPI_File /scratch/lib/libsimgrid.so.3.6.2, setting offset 0 +> (2@bob) Seeking in MPI_File /scratch/lib/libsimgrid.so.3.6.2, setting offset 0 +> (3@carl) Seeking in MPI_File /scratch/lib/libsimgrid.so.3.6.2, setting offset 0 +> (1@carl) Seeking in MPI_File /scratch/lib/libsimgrid.so.3.6.2, setting offset 0 +> (2@bob) Seeking in MPI_File /scratch/lib/libsimgrid.so.3.6.2, setting offset 80 +> (1@carl) Seeking in MPI_File /scratch/lib/libsimgrid.so.3.6.2, setting offset 40 +> (3@carl) Seeking in MPI_File /scratch/lib/libsimgrid.so.3.6.2, setting offset 120 +> (3@carl) Read in MPI_File /scratch/lib/libsimgrid.so.3.6.2, 40 bytes read, readsize 40 bytes, movesize 40 +> (3@carl) Position after read in MPI_File /scratch/lib/libsimgrid.so.3.6.2 : 160 +> (1@carl) Read in MPI_File /scratch/lib/libsimgrid.so.3.6.2, 40 bytes read, readsize 40 bytes, movesize 40 +> (1@carl) Position after read in MPI_File /scratch/lib/libsimgrid.so.3.6.2 : 80 +> (2@bob) Read in MPI_File /scratch/lib/libsimgrid.so.3.6.2, 40 bytes read, readsize 40 bytes, movesize 40 +> (2@bob) Position after read in MPI_File /scratch/lib/libsimgrid.so.3.6.2 : 120 +> (0@bob) Read in MPI_File /scratch/lib/libsimgrid.so.3.6.2, 40 bytes read, readsize 40 bytes, movesize 40 +> (0@bob) Position after read in MPI_File /scratch/lib/libsimgrid.so.3.6.2 : 40 +> (0@bob) Seeking in MPI_File /scratch/lib/libsimgrid.so.3.6.2, setting offset 0 +> (0@bob) Seeking in MPI_File /scratch/lib/libsimgrid.so.3.6.2, setting offset 0 +> (0@bob) Read in MPI_File /scratch/lib/libsimgrid.so.3.6.2, 4 bytes read, readsize 4 bytes, movesize 4 +> (0@bob) Position after read in MPI_File /scratch/lib/libsimgrid.so.3.6.2 : 4 +> (2@bob) Seeking in MPI_File /scratch/lib/libsimgrid.so.3.6.2, setting offset 0 +> (3@carl) Seeking in MPI_File /scratch/lib/libsimgrid.so.3.6.2, setting offset 0 +> (1@carl) Seeking in MPI_File /scratch/lib/libsimgrid.so.3.6.2, setting offset 0 +> (2@bob) Seeking in MPI_File /scratch/lib/libsimgrid.so.3.6.2, setting offset 0 +> (2@bob) Read in MPI_File /scratch/lib/libsimgrid.so.3.6.2, 4 bytes read, readsize 4 bytes, movesize 4 +> (2@bob) Position after read in MPI_File /scratch/lib/libsimgrid.so.3.6.2 : 4 +> (3@carl) Seeking in MPI_File /scratch/lib/libsimgrid.so.3.6.2, setting offset 4 +> (3@carl) Read in MPI_File /scratch/lib/libsimgrid.so.3.6.2, 4 bytes read, readsize 4 bytes, movesize 4 +> (3@carl) Position after read in MPI_File /scratch/lib/libsimgrid.so.3.6.2 : 8 +> (1@carl) Seeking in MPI_File /scratch/lib/libsimgrid.so.3.6.2, setting offset 8 +> (1@carl) Read in MPI_File /scratch/lib/libsimgrid.so.3.6.2, 4 bytes read, readsize 4 bytes, movesize 4 +> (1@carl) Position after read in MPI_File /scratch/lib/libsimgrid.so.3.6.2 : 12 +> (0@bob) Seeking in MPI_File /scratch/lib/libsimgrid.so.3.6.2, setting offset 0 +> (0@bob) Seeking in MPI_File /scratch/lib/libsimgrid.so.3.6.2, setting offset 0 +> (0@bob) Write in MPI_File /scratch/lib/libsimgrid.so.3.6.2, 4 bytes written, readsize 4 bytes, movesize 4 +> (0@bob) Position after write in MPI_File /scratch/lib/libsimgrid.so.3.6.2 : 4 +> (2@bob) Seeking in MPI_File /scratch/lib/libsimgrid.so.3.6.2, setting offset 0 +> (3@carl) Seeking in MPI_File /scratch/lib/libsimgrid.so.3.6.2, setting offset 0 +> (1@carl) Seeking in MPI_File /scratch/lib/libsimgrid.so.3.6.2, setting offset 0 +> (2@bob) Seeking in MPI_File /scratch/lib/libsimgrid.so.3.6.2, setting offset 0 +> (2@bob) Write in MPI_File /scratch/lib/libsimgrid.so.3.6.2, 4 bytes written, readsize 4 bytes, movesize 4 +> (2@bob) Position after write in MPI_File /scratch/lib/libsimgrid.so.3.6.2 : 4 +> (3@carl) Seeking in MPI_File /scratch/lib/libsimgrid.so.3.6.2, setting offset 4 +> (3@carl) Write in MPI_File /scratch/lib/libsimgrid.so.3.6.2, 4 bytes written, readsize 4 bytes, movesize 4 +> (3@carl) Position after write in MPI_File /scratch/lib/libsimgrid.so.3.6.2 : 8 +> (1@carl) Seeking in MPI_File /scratch/lib/libsimgrid.so.3.6.2, setting offset 8 +> (1@carl) Write in MPI_File /scratch/lib/libsimgrid.so.3.6.2, 4 bytes written, readsize 4 bytes, movesize 4 +> (1@carl) Position after write in MPI_File /scratch/lib/libsimgrid.so.3.6.2 : 12 diff --git a/teshsuite/smpi/io-simple-at/io-simple-at.c b/teshsuite/smpi/io-simple-at/io-simple-at.c index 6a6e161a3f..3ddf2e9eee 100644 --- a/teshsuite/smpi/io-simple-at/io-simple-at.c +++ b/teshsuite/smpi/io-simple-at/io-simple-at.c @@ -1,65 +1,65 @@ -#include "mpi.h" -#include -#include -#include -#include - -/* Test reading and writing zero bytes (set status correctly) */ - -int main( int argc, char *argv[] ) -{ - int errs = 0; - int size, rank, i, *buf, count; - MPI_File fh; - MPI_Comm comm; - MPI_Status status; - - MPI_Init( &argc, &argv ); - - comm = MPI_COMM_WORLD; - MPI_File_open( comm, (char*)"/scratch/lib/libsimgrid.so.3.6.2", MPI_MODE_RDWR | MPI_MODE_CREATE | MPI_MODE_DELETE_ON_CLOSE, MPI_INFO_NULL, &fh ); - MPI_Comm_size( comm, &size ); - MPI_Comm_rank( comm, &rank ); - buf = (int *)malloc( size * sizeof(int) ); - buf[0] = rank; - - /* Write to file */ - MPI_File_write_at( fh, sizeof(int)*rank, buf, 1, MPI_INT, &status ); - MPI_Get_count( &status, MPI_INT, &count ); - if (count != 1) { - errs++; - fprintf( stderr, "Wrong count (%d) on write_at\n", count );fflush(stderr); - } - - /* Read nothing (check status) */ - memset( &status, 0xff, sizeof(MPI_Status) ); - MPI_File_read_at( fh, sizeof(int)*rank, buf, 0, MPI_INT, &status ); - MPI_Get_count( &status, MPI_INT, &count ); - if (count != 0) { - errs++; - fprintf( stderr, "Count not zero (%d) on read\n", count );fflush(stderr); - } - - /* Write nothing (check status) */ - memset( &status, 0xff, sizeof(MPI_Status) ); - MPI_File_write_at( fh, sizeof(int)*rank, buf, 0, MPI_INT, &status ); - if (count != 0) { - errs++; - fprintf( stderr, "Count not zero (%d) on write\n", count );fflush(stderr); - } - - MPI_Barrier( comm ); - - for (i=0; i +#include +#include +#include + +/* Test reading and writing zero bytes (set status correctly) */ + +int main( int argc, char *argv[] ) +{ + int errs = 0; + int size, rank, i, *buf, count; + MPI_File fh; + MPI_Comm comm; + MPI_Status status; + + MPI_Init( &argc, &argv ); + + comm = MPI_COMM_WORLD; + MPI_File_open( comm, (char*)"/scratch/lib/libsimgrid.so.3.6.2", MPI_MODE_RDWR | MPI_MODE_CREATE | MPI_MODE_DELETE_ON_CLOSE, MPI_INFO_NULL, &fh ); + MPI_Comm_size( comm, &size ); + MPI_Comm_rank( comm, &rank ); + buf = (int *)malloc( size * sizeof(int) ); + buf[0] = rank; + + /* Write to file */ + MPI_File_write_at( fh, sizeof(int)*rank, buf, 1, MPI_INT, &status ); + MPI_Get_count( &status, MPI_INT, &count ); + if (count != 1) { + errs++; + fprintf( stderr, "Wrong count (%d) on write_at\n", count );fflush(stderr); + } + + /* Read nothing (check status) */ + memset( &status, 0xff, sizeof(MPI_Status) ); + MPI_File_read_at( fh, sizeof(int)*rank, buf, 0, MPI_INT, &status ); + MPI_Get_count( &status, MPI_INT, &count ); + if (count != 0) { + errs++; + fprintf( stderr, "Count not zero (%d) on read\n", count );fflush(stderr); + } + + /* Write nothing (check status) */ + memset( &status, 0xff, sizeof(MPI_Status) ); + MPI_File_write_at( fh, sizeof(int)*rank, buf, 0, MPI_INT, &status ); + if (count != 0) { + errs++; + fprintf( stderr, "Count not zero (%d) on write\n", count );fflush(stderr); + } + + MPI_Barrier( comm ); + + for (i=0; i You requested to use 4 ranks, but there is only 2 processes in your hostfile... -> [rank 0] -> bob -> [rank 1] -> carl -> [rank 2] -> bob -> [rank 3] -> carl -> [ 0.000282] (0@bob) Seeking in MPI_File /scratch/lib/libsimgrid.so.3.6.2, setting offset 0 -> [ 0.000358] (2@bob) Seeking in MPI_File /scratch/lib/libsimgrid.so.3.6.2, setting offset 8 -> [ 0.000383] (0@bob) Write in MPI_File /scratch/lib/libsimgrid.so.3.6.2, 4 bytes written, readsize 4 bytes, movesize 4 -> [ 0.000383] (0@bob) Position after write in MPI_File /scratch/lib/libsimgrid.so.3.6.2 : 4 -> [ 0.000459] (2@bob) Write in MPI_File /scratch/lib/libsimgrid.so.3.6.2, 4 bytes written, readsize 4 bytes, movesize 4 -> [ 0.000459] (2@bob) Position after write in MPI_File /scratch/lib/libsimgrid.so.3.6.2 : 12 -> [ 0.000534] (3@carl) Seeking in MPI_File /scratch/lib/libsimgrid.so.3.6.2, setting offset 12 -> [ 0.000534] (1@carl) Seeking in MPI_File /scratch/lib/libsimgrid.so.3.6.2, setting offset 4 -> [ 0.000534] (3@carl) Write in MPI_File /scratch/lib/libsimgrid.so.3.6.2, 4 bytes written, readsize 4 bytes, movesize 4 -> [ 0.000534] (3@carl) Position after write in MPI_File /scratch/lib/libsimgrid.so.3.6.2 : 16 -> [ 0.000534] (1@carl) Write in MPI_File /scratch/lib/libsimgrid.so.3.6.2, 4 bytes written, readsize 4 bytes, movesize 4 -> [ 0.000534] (1@carl) Position after write in MPI_File /scratch/lib/libsimgrid.so.3.6.2 : 8 -> [ 0.000584] (0@bob) Seeking in MPI_File /scratch/lib/libsimgrid.so.3.6.2, setting offset 0 -> [ 0.000599] (2@bob) Seeking in MPI_File /scratch/lib/libsimgrid.so.3.6.2, setting offset 8 -> [ 0.000634] (3@carl) Seeking in MPI_File /scratch/lib/libsimgrid.so.3.6.2, setting offset 12 -> [ 0.000634] (1@carl) Seeking in MPI_File /scratch/lib/libsimgrid.so.3.6.2, setting offset 4 -> [ 0.000634] (3@carl) Read in MPI_File /scratch/lib/libsimgrid.so.3.6.2, 4 bytes read, readsize 4 bytes, movesize 4 -> [ 0.000634] (3@carl) Position after read in MPI_File /scratch/lib/libsimgrid.so.3.6.2 : 16 -> [ 0.000634] (1@carl) Read in MPI_File /scratch/lib/libsimgrid.so.3.6.2, 4 bytes read, readsize 4 bytes, movesize 4 -> [ 0.000634] (1@carl) Position after read in MPI_File /scratch/lib/libsimgrid.so.3.6.2 : 8 -> [ 0.000685] (0@bob) Read in MPI_File /scratch/lib/libsimgrid.so.3.6.2, 4 bytes read, readsize 4 bytes, movesize 4 -> [ 0.000685] (0@bob) Position after read in MPI_File /scratch/lib/libsimgrid.so.3.6.2 : 4 -> [ 0.000700] (2@bob) Read in MPI_File /scratch/lib/libsimgrid.so.3.6.2, 4 bytes read, readsize 4 bytes, movesize 4 -> [ 0.000700] (2@bob) Position after read in MPI_File /scratch/lib/libsimgrid.so.3.6.2 : 12 +# Test for MPI_File_read and MPI_File_write +! output sort +$ ${bindir:=.}/../../../smpi_script/bin/smpirun -map -hostfile ../hostfile_io -platform ../../../examples/platforms/storage/remote_io.xml -np 4 --log=xbt_cfg.thres:critical --log=smpi_kernel.thres:warning --log=smpi_mpi.thres:error --log=smpi_io.thres:verbose "--log=root.fmt:(%P@%h)%e%m%n" --cfg=smpi/simulate-computation:0 ${bindir:=.}/io-simple-at +> You requested to use 4 ranks, but there is only 2 processes in your hostfile... +> [rank 0] -> bob +> [rank 1] -> carl +> [rank 2] -> bob +> [rank 3] -> carl +> (0@bob) Seeking in MPI_File /scratch/lib/libsimgrid.so.3.6.2, setting offset 0 +> (2@bob) Seeking in MPI_File /scratch/lib/libsimgrid.so.3.6.2, setting offset 8 +> (0@bob) Write in MPI_File /scratch/lib/libsimgrid.so.3.6.2, 4 bytes written, readsize 4 bytes, movesize 4 +> (0@bob) Position after write in MPI_File /scratch/lib/libsimgrid.so.3.6.2 : 4 +> (2@bob) Write in MPI_File /scratch/lib/libsimgrid.so.3.6.2, 4 bytes written, readsize 4 bytes, movesize 4 +> (2@bob) Position after write in MPI_File /scratch/lib/libsimgrid.so.3.6.2 : 12 +> (3@carl) Seeking in MPI_File /scratch/lib/libsimgrid.so.3.6.2, setting offset 12 +> (1@carl) Seeking in MPI_File /scratch/lib/libsimgrid.so.3.6.2, setting offset 4 +> (3@carl) Write in MPI_File /scratch/lib/libsimgrid.so.3.6.2, 4 bytes written, readsize 4 bytes, movesize 4 +> (3@carl) Position after write in MPI_File /scratch/lib/libsimgrid.so.3.6.2 : 16 +> (1@carl) Write in MPI_File /scratch/lib/libsimgrid.so.3.6.2, 4 bytes written, readsize 4 bytes, movesize 4 +> (1@carl) Position after write in MPI_File /scratch/lib/libsimgrid.so.3.6.2 : 8 +> (0@bob) Seeking in MPI_File /scratch/lib/libsimgrid.so.3.6.2, setting offset 0 +> (2@bob) Seeking in MPI_File /scratch/lib/libsimgrid.so.3.6.2, setting offset 8 +> (3@carl) Seeking in MPI_File /scratch/lib/libsimgrid.so.3.6.2, setting offset 12 +> (1@carl) Seeking in MPI_File /scratch/lib/libsimgrid.so.3.6.2, setting offset 4 +> (3@carl) Read in MPI_File /scratch/lib/libsimgrid.so.3.6.2, 4 bytes read, readsize 4 bytes, movesize 4 +> (3@carl) Position after read in MPI_File /scratch/lib/libsimgrid.so.3.6.2 : 16 +> (1@carl) Read in MPI_File /scratch/lib/libsimgrid.so.3.6.2, 4 bytes read, readsize 4 bytes, movesize 4 +> (1@carl) Position after read in MPI_File /scratch/lib/libsimgrid.so.3.6.2 : 8 +> (0@bob) Read in MPI_File /scratch/lib/libsimgrid.so.3.6.2, 4 bytes read, readsize 4 bytes, movesize 4 +> (0@bob) Position after read in MPI_File /scratch/lib/libsimgrid.so.3.6.2 : 4 +> (2@bob) Read in MPI_File /scratch/lib/libsimgrid.so.3.6.2, 4 bytes read, readsize 4 bytes, movesize 4 +> (2@bob) Position after read in MPI_File /scratch/lib/libsimgrid.so.3.6.2 : 12 diff --git a/teshsuite/smpi/io-simple/io-simple.c b/teshsuite/smpi/io-simple/io-simple.c index 33d8ef069e..9ee0db60cb 100644 --- a/teshsuite/smpi/io-simple/io-simple.c +++ b/teshsuite/smpi/io-simple/io-simple.c @@ -1,67 +1,67 @@ -#include "mpi.h" -#include -#include -#include -#include - -/* Test reading and writing zero bytes (set status correctly) */ - -int main( int argc, char *argv[] ) -{ - int errs = 0; - int size, rank, i, *buf, count; - MPI_File fh; - MPI_Comm comm; - MPI_Status status; - - MPI_Init( &argc, &argv ); - - comm = MPI_COMM_WORLD; - MPI_File_open( comm, (char*)"/scratch/lib/libsimgrid.so.3.6.2", MPI_MODE_RDWR | MPI_MODE_CREATE | MPI_MODE_DELETE_ON_CLOSE, MPI_INFO_NULL, &fh ); - MPI_Comm_size( comm, &size ); - MPI_Comm_rank( comm, &rank ); - buf = (int *)malloc( size * sizeof(int) ); - buf[0] = rank; - - /* Write to file */ - MPI_File_seek( fh, sizeof(int)*rank, MPI_SEEK_SET ); - MPI_File_write( fh, buf, 1, MPI_INT, &status ); - MPI_Get_count( &status, MPI_INT, &count ); - if (count != 1) { - errs++; - fprintf( stderr, "Wrong count (%d) on write\n", count );fflush(stderr); - } - - /* Read nothing (check status) */ - memset( &status, 0xff, sizeof(MPI_Status) ); - MPI_File_read( fh, buf, 0, MPI_INT, &status ); - MPI_Get_count( &status, MPI_INT, &count ); - if (count != 0) { - errs++; - fprintf( stderr, "Count not zero (%d) on read\n", count );fflush(stderr); - } - - /* Write nothing (check status) */ - memset( &status, 0xff, sizeof(MPI_Status) ); - MPI_File_write( fh, buf, 0, MPI_INT, &status ); - if (count != 0) { - errs++; - fprintf( stderr, "Count not zero (%d) on write\n", count );fflush(stderr); - } - - MPI_Barrier( comm ); - - MPI_File_seek( fh, sizeof(int)*rank, MPI_SEEK_SET ); - for (i=0; i +#include +#include +#include + +/* Test reading and writing zero bytes (set status correctly) */ + +int main( int argc, char *argv[] ) +{ + int errs = 0; + int size, rank, i, *buf, count; + MPI_File fh; + MPI_Comm comm; + MPI_Status status; + + MPI_Init( &argc, &argv ); + + comm = MPI_COMM_WORLD; + MPI_File_open( comm, (char*)"/scratch/lib/libsimgrid.so.3.6.2", MPI_MODE_RDWR | MPI_MODE_CREATE | MPI_MODE_DELETE_ON_CLOSE, MPI_INFO_NULL, &fh ); + MPI_Comm_size( comm, &size ); + MPI_Comm_rank( comm, &rank ); + buf = (int *)malloc( size * sizeof(int) ); + buf[0] = rank; + + /* Write to file */ + MPI_File_seek( fh, sizeof(int)*rank, MPI_SEEK_SET ); + MPI_File_write( fh, buf, 1, MPI_INT, &status ); + MPI_Get_count( &status, MPI_INT, &count ); + if (count != 1) { + errs++; + fprintf( stderr, "Wrong count (%d) on write\n", count );fflush(stderr); + } + + /* Read nothing (check status) */ + memset( &status, 0xff, sizeof(MPI_Status) ); + MPI_File_read( fh, buf, 0, MPI_INT, &status ); + MPI_Get_count( &status, MPI_INT, &count ); + if (count != 0) { + errs++; + fprintf( stderr, "Count not zero (%d) on read\n", count );fflush(stderr); + } + + /* Write nothing (check status) */ + memset( &status, 0xff, sizeof(MPI_Status) ); + MPI_File_write( fh, buf, 0, MPI_INT, &status ); + if (count != 0) { + errs++; + fprintf( stderr, "Count not zero (%d) on write\n", count );fflush(stderr); + } + + MPI_Barrier( comm ); + + MPI_File_seek( fh, sizeof(int)*rank, MPI_SEEK_SET ); + for (i=0; i You requested to use 4 ranks, but there is only 2 processes in your hostfile... -> [rank 0] -> bob -> [rank 1] -> carl -> [rank 2] -> bob -> [rank 3] -> carl -> [ 0.000282] (0@bob) Seeking in MPI_File /scratch/lib/libsimgrid.so.3.6.2, setting offset 0 -> [ 0.000358] (2@bob) Seeking in MPI_File /scratch/lib/libsimgrid.so.3.6.2, setting offset 8 -> [ 0.000383] (0@bob) Write in MPI_File /scratch/lib/libsimgrid.so.3.6.2, 4 bytes written, readsize 4 bytes, movesize 4 -> [ 0.000383] (0@bob) Position after write in MPI_File /scratch/lib/libsimgrid.so.3.6.2 : 4 -> [ 0.000459] (2@bob) Write in MPI_File /scratch/lib/libsimgrid.so.3.6.2, 4 bytes written, readsize 4 bytes, movesize 4 -> [ 0.000459] (2@bob) Position after write in MPI_File /scratch/lib/libsimgrid.so.3.6.2 : 12 -> [ 0.000534] (3@carl) Seeking in MPI_File /scratch/lib/libsimgrid.so.3.6.2, setting offset 12 -> [ 0.000534] (1@carl) Seeking in MPI_File /scratch/lib/libsimgrid.so.3.6.2, setting offset 4 -> [ 0.000534] (3@carl) Write in MPI_File /scratch/lib/libsimgrid.so.3.6.2, 4 bytes written, readsize 4 bytes, movesize 4 -> [ 0.000534] (3@carl) Position after write in MPI_File /scratch/lib/libsimgrid.so.3.6.2 : 16 -> [ 0.000534] (1@carl) Write in MPI_File /scratch/lib/libsimgrid.so.3.6.2, 4 bytes written, readsize 4 bytes, movesize 4 -> [ 0.000534] (1@carl) Position after write in MPI_File /scratch/lib/libsimgrid.so.3.6.2 : 8 -> [ 0.000584] (0@bob) Seeking in MPI_File /scratch/lib/libsimgrid.so.3.6.2, setting offset 0 -> [ 0.000599] (2@bob) Seeking in MPI_File /scratch/lib/libsimgrid.so.3.6.2, setting offset 8 -> [ 0.000634] (3@carl) Seeking in MPI_File /scratch/lib/libsimgrid.so.3.6.2, setting offset 12 -> [ 0.000634] (1@carl) Seeking in MPI_File /scratch/lib/libsimgrid.so.3.6.2, setting offset 4 -> [ 0.000634] (3@carl) Read in MPI_File /scratch/lib/libsimgrid.so.3.6.2, 4 bytes read, readsize 4 bytes, movesize 4 -> [ 0.000634] (3@carl) Position after read in MPI_File /scratch/lib/libsimgrid.so.3.6.2 : 16 -> [ 0.000634] (1@carl) Read in MPI_File /scratch/lib/libsimgrid.so.3.6.2, 4 bytes read, readsize 4 bytes, movesize 4 -> [ 0.000634] (1@carl) Position after read in MPI_File /scratch/lib/libsimgrid.so.3.6.2 : 8 -> [ 0.000685] (0@bob) Read in MPI_File /scratch/lib/libsimgrid.so.3.6.2, 4 bytes read, readsize 4 bytes, movesize 4 -> [ 0.000685] (0@bob) Position after read in MPI_File /scratch/lib/libsimgrid.so.3.6.2 : 4 -> [ 0.000700] (2@bob) Read in MPI_File /scratch/lib/libsimgrid.so.3.6.2, 4 bytes read, readsize 4 bytes, movesize 4 -> [ 0.000700] (2@bob) Position after read in MPI_File /scratch/lib/libsimgrid.so.3.6.2 : 12 +# Test for MPI_File_read and MPI_File_write +! output sort +$ ${bindir:=.}/../../../smpi_script/bin/smpirun -map -hostfile ../hostfile_io -platform ../../../examples/platforms/storage/remote_io.xml -np 4 --log=xbt_cfg.thres:critical --log=smpi_kernel.thres:warning --log=smpi_mpi.thres:error --log=smpi_io.thres:verbose "--log=root.fmt:(%P@%h)%e%m%n" --cfg=smpi/simulate-computation:0 ${bindir:=.}/io-simple +> You requested to use 4 ranks, but there is only 2 processes in your hostfile... +> [rank 0] -> bob +> [rank 1] -> carl +> [rank 2] -> bob +> [rank 3] -> carl +> (0@bob) Seeking in MPI_File /scratch/lib/libsimgrid.so.3.6.2, setting offset 0 +> (2@bob) Seeking in MPI_File /scratch/lib/libsimgrid.so.3.6.2, setting offset 8 +> (0@bob) Write in MPI_File /scratch/lib/libsimgrid.so.3.6.2, 4 bytes written, readsize 4 bytes, movesize 4 +> (0@bob) Position after write in MPI_File /scratch/lib/libsimgrid.so.3.6.2 : 4 +> (2@bob) Write in MPI_File /scratch/lib/libsimgrid.so.3.6.2, 4 bytes written, readsize 4 bytes, movesize 4 +> (2@bob) Position after write in MPI_File /scratch/lib/libsimgrid.so.3.6.2 : 12 +> (3@carl) Seeking in MPI_File /scratch/lib/libsimgrid.so.3.6.2, setting offset 12 +> (1@carl) Seeking in MPI_File /scratch/lib/libsimgrid.so.3.6.2, setting offset 4 +> (3@carl) Write in MPI_File /scratch/lib/libsimgrid.so.3.6.2, 4 bytes written, readsize 4 bytes, movesize 4 +> (3@carl) Position after write in MPI_File /scratch/lib/libsimgrid.so.3.6.2 : 16 +> (1@carl) Write in MPI_File /scratch/lib/libsimgrid.so.3.6.2, 4 bytes written, readsize 4 bytes, movesize 4 +> (1@carl) Position after write in MPI_File /scratch/lib/libsimgrid.so.3.6.2 : 8 +> (0@bob) Seeking in MPI_File /scratch/lib/libsimgrid.so.3.6.2, setting offset 0 +> (2@bob) Seeking in MPI_File /scratch/lib/libsimgrid.so.3.6.2, setting offset 8 +> (3@carl) Seeking in MPI_File /scratch/lib/libsimgrid.so.3.6.2, setting offset 12 +> (1@carl) Seeking in MPI_File /scratch/lib/libsimgrid.so.3.6.2, setting offset 4 +> (3@carl) Read in MPI_File /scratch/lib/libsimgrid.so.3.6.2, 4 bytes read, readsize 4 bytes, movesize 4 +> (3@carl) Position after read in MPI_File /scratch/lib/libsimgrid.so.3.6.2 : 16 +> (1@carl) Read in MPI_File /scratch/lib/libsimgrid.so.3.6.2, 4 bytes read, readsize 4 bytes, movesize 4 +> (1@carl) Position after read in MPI_File /scratch/lib/libsimgrid.so.3.6.2 : 8 +> (0@bob) Read in MPI_File /scratch/lib/libsimgrid.so.3.6.2, 4 bytes read, readsize 4 bytes, movesize 4 +> (0@bob) Position after read in MPI_File /scratch/lib/libsimgrid.so.3.6.2 : 4 +> (2@bob) Read in MPI_File /scratch/lib/libsimgrid.so.3.6.2, 4 bytes read, readsize 4 bytes, movesize 4 +> (2@bob) Position after read in MPI_File /scratch/lib/libsimgrid.so.3.6.2 : 12 -- 2.20.1