X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/8961af09af49ac83a8cadf9dc2f7677a56edf127..5a1c4c690d9181a576844f90b6a50c75caf5f3c1:/src/smpi/smpi_win.cpp diff --git a/src/smpi/smpi_win.cpp b/src/smpi/smpi_win.cpp index e2d6b5f3a8..6ddaeb52bf 100644 --- a/src/smpi/smpi_win.cpp +++ b/src/smpi/smpi_win.cpp @@ -1,11 +1,17 @@ -/* Copyright (c) 2007-2017. The SimGrid Team. - * All rights reserved. */ +/* Copyright (c) 2007-2017. 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.h" -#include +#include "src/smpi/private.h" +#include "src/smpi/smpi_coll.hpp" +#include "src/smpi/smpi_comm.hpp" +#include "src/smpi/smpi_datatype.hpp" +#include "src/smpi/smpi_info.hpp" +#include "src/smpi/smpi_keyvals.hpp" +#include "src/smpi/smpi_process.hpp" +#include "src/smpi/smpi_request.hpp" +#include "src/smpi/smpi_win.hpp" XBT_LOG_NEW_DEFAULT_SUBCATEGORY(smpi_rma, smpi, "Logging specific to SMPI (RMA operations)"); @@ -78,7 +84,7 @@ Win::~Win(){ } int Win::attach (void *base, MPI_Aint size){ - if (!(base_ == MPI_BOTTOM || base_ == 0)) + if (not(base_ == MPI_BOTTOM || base_ == 0)) return MPI_ERR_ARG; base_=0;//actually the address will be given in the RMA calls, as being the disp. size_+=size; @@ -413,7 +419,7 @@ int Win::compare_and_swap(void *origin_addr, void *compare_addr, target_disp, 1, datatype, &req); if (req != MPI_REQUEST_NULL) Request::wait(&req, MPI_STATUS_IGNORE); - if(! memcmp (result_addr, compare_addr, datatype->get_extent() )){ + if (not memcmp(result_addr, compare_addr, datatype->get_extent())) { put(origin_addr, 1, datatype, target_rank, target_disp, 1, datatype); } @@ -567,8 +573,8 @@ int Win::lock(int lock_type, int rank, int assert){ if(lock_type == MPI_LOCK_SHARED){//the window used to be exclusive, it's now shared. xbt_mutex_release(target_win->lock_mut_); } - } else if(!(target_win->mode_==MPI_LOCK_SHARED && lock_type == MPI_LOCK_EXCLUSIVE)) - target_win->mode_+= lock_type; // don't set to exclusive if it's already shared + } else if (not(target_win->mode_ == MPI_LOCK_SHARED && lock_type == MPI_LOCK_EXCLUSIVE)) + target_win->mode_ += lock_type; // don't set to exclusive if it's already shared target_win->lockers_.push_back(comm_->rank()); @@ -676,22 +682,21 @@ int Win::finish_comms(int rank){ int size = static_cast(reqqs->size()); if (size > 0) { size = 0; - std::vector* myreqqs = new std::vector(); + std::vector myreqqs; std::vector::iterator iter = reqqs->begin(); while (iter != reqqs->end()){ if(((*iter)!=MPI_REQUEST_NULL) && (((*iter)->src() == rank) || ((*iter)->dst() == rank))){ - myreqqs->push_back(*iter); - iter = reqqs->erase(iter); - size++; + myreqqs.push_back(*iter); + iter = reqqs->erase(iter); + size++; } else { ++iter; } } if(size >0){ - MPI_Request* treqs = &(*myreqqs)[0]; + MPI_Request* treqs = &myreqqs[0]; Request::waitall(size, treqs, MPI_STATUSES_IGNORE); - myreqqs->clear(); - delete myreqqs; + myreqqs.clear(); } } xbt_mutex_release(mut_);