From 09fe3bc07ad8fa514b0d38bcfcf5527ba4d7cae6 Mon Sep 17 00:00:00 2001 From: Martin Quinson Date: Sun, 12 Mar 2017 21:34:34 +0100 Subject: [PATCH] please sonar on recent SMPI++ code Late sunday commit... --- src/smpi/smpi_base.cpp | 19 ++++++++----------- src/smpi/smpi_global.cpp | 3 +-- 2 files changed, 9 insertions(+), 13 deletions(-) diff --git a/src/smpi/smpi_base.cpp b/src/smpi/smpi_base.cpp index 1ad773593c..141d8e91b2 100644 --- a/src/smpi/smpi_base.cpp +++ b/src/smpi/smpi_base.cpp @@ -1,5 +1,4 @@ -/* Copyright (c) 2007-2015. 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. */ @@ -366,8 +365,8 @@ void smpi_mpi_reduce(void *sendbuf, void *recvbuf, int count, MPI_Datatype datat }else{ Request::unref(&requests[index]); } - if(op) /* op can be MPI_OP_NULL that does nothing */ - if(op!=MPI_OP_NULL) op->apply( tmpbufs[index], recvbuf, &count, datatype); + if (op != MPI_OP_NULL) /* op can be MPI_OP_NULL that does nothing */ + op->apply(tmpbufs[index], recvbuf, &count, datatype); } for(index = 0; index < size - 1; index++) { smpi_free_tmp_buffer(tmpbufs[index]); @@ -423,18 +422,16 @@ void smpi_mpi_scan(void *sendbuf, void *recvbuf, int count, MPI_Datatype datatyp if(index == MPI_UNDEFINED) { break; } - if(index < rank) { - // #Request is below rank: it's a irecv - if(op!=MPI_OP_NULL) op->apply( tmpbufs[index], recvbuf, &count, datatype); - } + if (index < rank) + // #Request is below rank: it's a irecv. + op->apply(tmpbufs[index], recvbuf, &count, datatype); } }else{ //non commutative case, wait in order for (int other = 0; other < size - 1; other++) { Request::wait(&(requests[other]), MPI_STATUS_IGNORE); - if(index < rank) { - if(op!=MPI_OP_NULL) op->apply( tmpbufs[other], recvbuf, &count, datatype); - } + if (index < rank && op != MPI_OP_NULL) + op->apply(tmpbufs[other], recvbuf, &count, datatype); } } for(index = 0; index < rank; index++) { diff --git a/src/smpi/smpi_global.cpp b/src/smpi/smpi_global.cpp index b70008be57..1e6fd35f05 100644 --- a/src/smpi/smpi_global.cpp +++ b/src/smpi/smpi_global.cpp @@ -1,5 +1,4 @@ -/* Copyright (c) 2007-2015. 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. */ -- 2.20.1