/* 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 <simgrid/s4u/engine.hpp>
-#include <simgrid/s4u/host.hpp>
-
-#include "private.h"
+#include "simgrid/s4u/Engine.hpp"
+#include "simgrid/s4u/Host.hpp"
+#include "src/smpi/private.h"
+#include "src/smpi/smpi_comm.hpp"
+#include "src/smpi/smpi_coll.hpp"
+#include "src/smpi/smpi_datatype_derived.hpp"
+#include "src/smpi/smpi_op.hpp"
+#include "src/smpi/smpi_process.hpp"
+#include "src/smpi/smpi_request.hpp"
+#include "src/smpi/smpi_status.hpp"
+#include "src/smpi/smpi_win.hpp"
XBT_LOG_NEW_DEFAULT_SUBCATEGORY(smpi_pmpi, smpi, "Logging specific to SMPI (pmpi)");
retval = MPI_ERR_ARG;
} else if (comm == MPI_COMM_NULL) {
retval = MPI_ERR_COMM;
- } else if (!datatype->is_valid()) {
- retval = MPI_ERR_TYPE;
+ } else if (not datatype->is_valid()) {
+ retval = MPI_ERR_TYPE;
} else if (dst == MPI_PROC_NULL) {
retval = MPI_SUCCESS;
} else {
retval = MPI_ERR_ARG;
} else if (comm == MPI_COMM_NULL) {
retval = MPI_ERR_COMM;
- } else if (!datatype->is_valid()) {
- retval = MPI_ERR_TYPE;
+ } else if (not datatype->is_valid()) {
+ retval = MPI_ERR_TYPE;
} else if (src == MPI_PROC_NULL) {
retval = MPI_SUCCESS;
} else {
retval = MPI_ERR_ARG;
} else if (comm == MPI_COMM_NULL) {
retval = MPI_ERR_COMM;
- } else if (!datatype->is_valid()) {
- retval = MPI_ERR_TYPE;
+ } else if (not datatype->is_valid()) {
+ retval = MPI_ERR_TYPE;
} else if (dst == MPI_PROC_NULL) {
retval = MPI_SUCCESS;
} else {
retval = MPI_ERR_RANK;
} else if ((count < 0) || (buf==nullptr && count > 0)) {
retval = MPI_ERR_COUNT;
- } else if (!datatype->is_valid()) {
- retval = MPI_ERR_TYPE;
+ } else if (not datatype->is_valid()) {
+ retval = MPI_ERR_TYPE;
} else if(tag<0 && tag != MPI_ANY_TAG){
retval = MPI_ERR_TAG;
} else {
retval = MPI_ERR_RANK;
} else if ((count < 0) || (buf==nullptr && count > 0)) {
retval = MPI_ERR_COUNT;
- } else if (!datatype->is_valid()) {
- retval = MPI_ERR_TYPE;
+ } else if (not datatype->is_valid()) {
+ retval = MPI_ERR_TYPE;
} else if(tag<0 && tag != MPI_ANY_TAG){
retval = MPI_ERR_TAG;
} else {
retval = MPI_ERR_RANK;
} else if ((count < 0)|| (buf==nullptr && count > 0)) {
retval = MPI_ERR_COUNT;
- } else if (!datatype->is_valid()) {
- retval = MPI_ERR_TYPE;
+ } else if (not datatype->is_valid()) {
+ retval = MPI_ERR_TYPE;
} else if(tag<0 && tag != MPI_ANY_TAG){
retval = MPI_ERR_TAG;
} else {
retval = MPI_ERR_RANK;
} else if ((count < 0) || (buf==nullptr && count > 0)) {
retval = MPI_ERR_COUNT;
- } else if (!datatype->is_valid()) {
- retval = MPI_ERR_TYPE;
+ } else if (not datatype->is_valid()) {
+ retval = MPI_ERR_TYPE;
} else if(tag<0 && tag != MPI_ANY_TAG){
retval = MPI_ERR_TAG;
} else {
// the src may not have been known at the beginning of the recv (MPI_ANY_SOURCE)
if (status != MPI_STATUS_IGNORE) {
src_traced = comm->group()->index(status->MPI_SOURCE);
- if (!TRACE_smpi_view_internals()) {
+ if (not TRACE_smpi_view_internals()) {
TRACE_smpi_recv(rank, src_traced, rank, tag);
}
}
retval = MPI_ERR_RANK;
} else if ((count < 0) || (buf == nullptr && count > 0)) {
retval = MPI_ERR_COUNT;
- } else if (!datatype->is_valid()) {
+ } else if (not datatype->is_valid()) {
retval = MPI_ERR_TYPE;
} else if(tag < 0 && tag != MPI_ANY_TAG){
retval = MPI_ERR_TAG;
}
extra->send_size = count*dt_size_send;
TRACE_smpi_ptp_in(rank, rank, dst_traced, __FUNCTION__, extra);
- if (!TRACE_smpi_view_internals()) {
+ if (not TRACE_smpi_view_internals()) {
TRACE_smpi_send(rank, rank, dst_traced, tag,count*datatype->size());
}
retval = MPI_ERR_RANK;
} else if ((count < 0) || (buf==nullptr && count > 0)) {
retval = MPI_ERR_COUNT;
- } else if (!datatype->is_valid()){
+ } else if (not datatype->is_valid()) {
retval = MPI_ERR_TYPE;
} else if(tag<0 && tag != MPI_ANY_TAG){
retval = MPI_ERR_TAG;
if (comm == MPI_COMM_NULL) {
retval = MPI_ERR_COMM;
- } else if (!sendtype->is_valid() || !recvtype->is_valid()) {
+ } else if (not sendtype->is_valid() || not recvtype->is_valid()) {
retval = MPI_ERR_TYPE;
} else if (src == MPI_PROC_NULL || dst == MPI_PROC_NULL) {
simgrid::smpi::Status::empty(status);
MPI_Comm comm, MPI_Status* status)
{
int retval = 0;
- if (!datatype->is_valid()) {
+ if (not datatype->is_valid()) {
return MPI_ERR_TYPE;
} else if (count < 0) {
return MPI_ERR_COUNT;
if (comm == MPI_COMM_NULL) {
retval = MPI_ERR_COMM;
- } else if (!datatype->is_valid()) {
+ } else if (not datatype->is_valid()) {
retval = MPI_ERR_ARG;
} else {
int rank = comm != MPI_COMM_NULL ? smpi_process()->index() : -1;
if (comm == MPI_COMM_NULL) {
retval = MPI_ERR_COMM;
- } else if (((comm->rank() == root) && (!sendtype->is_valid())) ||
- ((recvbuf != MPI_IN_PLACE) && (!recvtype->is_valid()))) {
+ } else if (((comm->rank() == root) && (not sendtype->is_valid())) ||
+ ((recvbuf != MPI_IN_PLACE) && (not recvtype->is_valid()))) {
retval = MPI_ERR_TYPE;
} else if ((sendbuf == recvbuf) ||
((comm->rank()==root) && sendcount>0 && (sendbuf == nullptr))){
if (comm == MPI_COMM_NULL) {
retval = MPI_ERR_COMM;
- } else if (!datatype->is_valid() || op == MPI_OP_NULL) {
+ } else if (not datatype->is_valid() || op == MPI_OP_NULL) {
retval = MPI_ERR_ARG;
} else {
int rank = comm != MPI_COMM_NULL ? smpi_process()->index() : -1;
int retval = 0;
smpi_bench_end();
- if (!datatype->is_valid() || op == MPI_OP_NULL) {
+ if (not datatype->is_valid() || op == MPI_OP_NULL) {
retval = MPI_ERR_ARG;
} else {
op->apply(inbuf, inoutbuf, &count, datatype);
if (comm == MPI_COMM_NULL) {
retval = MPI_ERR_COMM;
- } else if (!datatype->is_valid()) {
+ } else if (not datatype->is_valid()) {
retval = MPI_ERR_TYPE;
} else if (op == MPI_OP_NULL) {
retval = MPI_ERR_OP;
if (comm == MPI_COMM_NULL) {
retval = MPI_ERR_COMM;
- } else if (!datatype->is_valid()) {
+ } else if (not datatype->is_valid()) {
retval = MPI_ERR_TYPE;
} else if (op == MPI_OP_NULL) {
retval = MPI_ERR_OP;
if (comm == MPI_COMM_NULL) {
retval = MPI_ERR_COMM;
- } else if (!datatype->is_valid()) {
+ } else if (not datatype->is_valid()) {
retval = MPI_ERR_TYPE;
} else if (op == MPI_OP_NULL) {
retval = MPI_ERR_OP;
if (comm == MPI_COMM_NULL) {
retval = MPI_ERR_COMM;
- } else if (!datatype->is_valid()) {
+ } else if (not datatype->is_valid()) {
retval = MPI_ERR_TYPE;
} else if (op == MPI_OP_NULL) {
retval = MPI_ERR_OP;
if (comm == MPI_COMM_NULL) {
retval = MPI_ERR_COMM;
- } else if (!datatype->is_valid()) {
+ } else if (not datatype->is_valid()) {
retval = MPI_ERR_TYPE;
} else if (op == MPI_OP_NULL) {
retval = MPI_ERR_OP;
extra->recvcounts = xbt_new(int, size);
extra->sendcounts = xbt_new(int, size);
int known = 0;
- int dt_size_recv = 1;
extra->datatype2 = encode_datatype(recvtype, &known);
- dt_size_recv = recvtype->size();
+ int dt_size_recv = recvtype->size();
void* sendtmpbuf = static_cast<char*>(sendbuf);
int* sendtmpcounts = sendcounts;
{
if (status == nullptr || count == nullptr) {
return MPI_ERR_ARG;
- } else if (!datatype->is_valid()) {
+ } else if (not datatype->is_valid()) {
return MPI_ERR_TYPE;
} else {
size_t size = datatype->size();
} else if ((origin_count < 0 || target_count < 0) ||
(origin_addr==nullptr && origin_count > 0)){
retval = MPI_ERR_COUNT;
- } else if ((!origin_datatype->is_valid()) || (!target_datatype->is_valid())) {
+ } else if ((not origin_datatype->is_valid()) || (not target_datatype->is_valid())) {
retval = MPI_ERR_TYPE;
} else {
int rank = smpi_process()->index();
} else if ((origin_count < 0 || target_count < 0) ||
(origin_addr==nullptr && origin_count > 0)){
retval = MPI_ERR_COUNT;
- } else if ((!origin_datatype->is_valid()) || (!target_datatype->is_valid())) {
+ } else if ((not origin_datatype->is_valid()) || (not target_datatype->is_valid())) {
retval = MPI_ERR_TYPE;
} else if(request == nullptr){
retval = MPI_ERR_REQUEST;
} else if ((origin_count < 0 || target_count < 0) ||
(origin_addr==nullptr && origin_count > 0)){
retval = MPI_ERR_COUNT;
- } else if ((!origin_datatype->is_valid()) || (!target_datatype->is_valid())) {
+ } else if ((not origin_datatype->is_valid()) || (not target_datatype->is_valid())) {
retval = MPI_ERR_TYPE;
} else {
int rank = smpi_process()->index();
} else if ((origin_count < 0 || target_count < 0) ||
(origin_addr==nullptr && origin_count > 0)){
retval = MPI_ERR_COUNT;
- } else if ((!origin_datatype->is_valid()) || (!target_datatype->is_valid())) {
+ } else if ((not origin_datatype->is_valid()) || (not target_datatype->is_valid())) {
retval = MPI_ERR_TYPE;
} else if(request == nullptr){
retval = MPI_ERR_REQUEST;
} else if ((origin_count < 0 || target_count < 0) ||
(origin_addr==nullptr && origin_count > 0)){
retval = MPI_ERR_COUNT;
- } else if ((!origin_datatype->is_valid()) ||
- (!target_datatype->is_valid())) {
+ } else if ((not origin_datatype->is_valid()) || (not target_datatype->is_valid())) {
retval = MPI_ERR_TYPE;
} else if (op == MPI_OP_NULL) {
retval = MPI_ERR_OP;
} else if ((origin_count < 0 || target_count < 0) ||
(origin_addr==nullptr && origin_count > 0)){
retval = MPI_ERR_COUNT;
- } else if ((!origin_datatype->is_valid()) ||
- (!target_datatype->is_valid())) {
+ } else if ((not origin_datatype->is_valid()) || (not target_datatype->is_valid())) {
retval = MPI_ERR_TYPE;
} else if (op == MPI_OP_NULL) {
retval = MPI_ERR_OP;
(origin_addr==nullptr && origin_count > 0 && op != MPI_NO_OP) ||
(result_addr==nullptr && result_count > 0)){
retval = MPI_ERR_COUNT;
- } else if ((origin_datatype!=MPI_DATATYPE_NULL && !origin_datatype->is_valid()) ||
- (!target_datatype->is_valid())||
- (!result_datatype->is_valid())) {
+ } else if ((origin_datatype != MPI_DATATYPE_NULL && not origin_datatype->is_valid()) ||
+ (not target_datatype->is_valid()) || (not result_datatype->is_valid())) {
retval = MPI_ERR_TYPE;
} else if (op == MPI_OP_NULL) {
retval = MPI_ERR_OP;
(origin_addr==nullptr && origin_count > 0 && op != MPI_NO_OP) ||
(result_addr==nullptr && result_count > 0)){
retval = MPI_ERR_COUNT;
- } else if ((origin_datatype!=MPI_DATATYPE_NULL && !origin_datatype->is_valid()) ||
- (!target_datatype->is_valid())||
- (!result_datatype->is_valid())) {
+ } else if ((origin_datatype != MPI_DATATYPE_NULL && not origin_datatype->is_valid()) ||
+ (not target_datatype->is_valid()) || (not result_datatype->is_valid())) {
retval = MPI_ERR_TYPE;
} else if (op == MPI_OP_NULL) {
retval = MPI_ERR_OP;
retval = MPI_ERR_ARG;
} else if (origin_addr==nullptr || result_addr==nullptr || compare_addr==nullptr){
retval = MPI_ERR_COUNT;
- } else if (!datatype->is_valid()) {
+ } else if (not datatype->is_valid()) {
retval = MPI_ERR_TYPE;
} else {
int rank = smpi_process()->index();
int PMPI_Unpack(void* inbuf, int incount, int* position, void* outbuf, int outcount, MPI_Datatype type, MPI_Comm comm) {
if(incount<0 || outcount < 0 || inbuf==nullptr || outbuf==nullptr)
return MPI_ERR_ARG;
- if(!type->is_valid())
+ if (not type->is_valid())
return MPI_ERR_TYPE;
if(comm==MPI_COMM_NULL)
return MPI_ERR_COMM;
int PMPI_Pack(void* inbuf, int incount, MPI_Datatype type, void* outbuf, int outcount, int* position, MPI_Comm comm) {
if(incount<0 || outcount < 0|| inbuf==nullptr || outbuf==nullptr)
return MPI_ERR_ARG;
- if(!type->is_valid())
+ if (not type->is_valid())
return MPI_ERR_TYPE;
if(comm==MPI_COMM_NULL)
return MPI_ERR_COMM;
int PMPI_Pack_size(int incount, MPI_Datatype datatype, MPI_Comm comm, int* size) {
if(incount<0)
return MPI_ERR_ARG;
- if(!datatype->is_valid())
+ if (not datatype->is_valid())
return MPI_ERR_TYPE;
if(comm==MPI_COMM_NULL)
return MPI_ERR_COMM;