X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/fe304706848f0a64477d4687b3ea97d5b9a0c35c..b6dde5ff6f208b83545a4b4e9e81712d0d8617a1:/src/smpi/include/smpi_file.hpp diff --git a/src/smpi/include/smpi_file.hpp b/src/smpi/include/smpi_file.hpp index 97ef812ab9..24e653be92 100644 --- a/src/smpi/include/smpi_file.hpp +++ b/src/smpi/include/smpi_file.hpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2010-2019. The SimGrid Team. +/* Copyright (c) 2010-2020. The SimGrid Team. * All rights reserved. */ /* This program is free software; you can redistribute it and/or modify it @@ -10,6 +10,7 @@ #include "smpi_comm.hpp" #include "smpi_coll.hpp" #include "smpi_datatype.hpp" +#include "smpi_errhandler.hpp" #include "smpi_info.hpp" #include @@ -26,6 +27,11 @@ class File{ s4u::MutexPtr shared_mutex_; MPI_Win win_; char* list_; + MPI_Errhandler errhandler_; + MPI_Datatype etype_; + MPI_Datatype filetype_; + std::string datarep_; + public: File(MPI_Comm comm, const char *filename, int amode, MPI_Info info); File(const File&) = delete; @@ -39,6 +45,8 @@ class File{ int sync(); int seek(MPI_Offset offset, int whence); int seek_shared(MPI_Offset offset, int whence); + int set_view(MPI_Offset disp, MPI_Datatype etype, MPI_Datatype filetype, const char* datarep, const Info* info); + int get_view(MPI_Offset *disp, MPI_Datatype *etype, MPI_Datatype *filetype, char *datarep); 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); @@ -49,7 +57,9 @@ class File{ static int write_ordered(MPI_File fh, const 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(const char *filename, MPI_Info info); + static int del(const char* filename, const Info* info); + MPI_Errhandler errhandler(); + void set_errhandler( MPI_Errhandler errhandler); }; /* Read_all, Write_all : loosely based on */ @@ -66,11 +76,11 @@ class File{ 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 max_offset = min_offset + count * datatype->get_extent();//cheating, as we don't care about exact data location, we can skip extent MPI_Offset* min_offsets = new MPI_Offset[size]; MPI_Offset* max_offsets = 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_); + 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; @@ -97,7 +107,8 @@ class File{ delete[] min_offsets; delete[] max_offsets; //contiguous. Just have each proc perform its read - status->count=count * datatype->size(); + if(status != MPI_STATUS_IGNORE) + status->count=count * datatype->size(); return T(this,buf,count,datatype, status); } @@ -116,7 +127,7 @@ class File{ if((my_chunk_start>=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 + // store min and max offset to actually read min_offset=std::min(min_offset, min_offsets[i]); total_sent+=send_sizes[i]; XBT_CDEBUG(smpi_pmpi, "will have to send %d bytes to %d", send_sizes[i], i); @@ -166,16 +177,17 @@ class File{ 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_); + 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(); + simgrid::smpi::colls::alltoallv(sendbuf, send_sizes, send_disps, MPI_BYTE, buf, recv_sizes, recv_disps, MPI_BYTE, + comm_); + if(status!=MPI_STATUS_IGNORE) + status->count=count * datatype->size(); smpi_free_tmp_buffer(sendbuf); delete[] send_sizes; delete[] recv_sizes;