X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/f06041cf2c450457a0b47a49b66b19cb9133c18e..954676b700e711f38ec4d286d33d5427d3f4ca46:/src/smpi/smpi_pmpi.c diff --git a/src/smpi/smpi_pmpi.c b/src/smpi/smpi_pmpi.c index 75e2eddbe8..fae36905ad 100644 --- a/src/smpi/smpi_pmpi.c +++ b/src/smpi/smpi_pmpi.c @@ -1,5 +1,5 @@ -/* Copyright (c) 2007-2014. The SimGrid Team. +/* Copyright (c) 2007-2015. The SimGrid Team. * All rights reserved. */ /* This program is free software; you can redistribute it and/or modify it @@ -1171,7 +1171,9 @@ int PMPI_Recv(void *buf, int count, MPI_Datatype datatype, int src, int tag, //the src may not have been known at the beginning of the recv (MPI_ANY_SOURCE) if(status!=MPI_STATUS_IGNORE){ src_traced = smpi_group_index(smpi_comm_group(comm), status->MPI_SOURCE); - TRACE_smpi_recv(rank, src_traced, rank); + if (!TRACE_smpi_view_internals()) { + TRACE_smpi_recv(rank, src_traced, rank); + } } TRACE_smpi_ptp_out(rank, src_traced, rank, __FUNCTION__); } @@ -1216,7 +1218,9 @@ int PMPI_Send(void *buf, int count, MPI_Datatype datatype, int dst, int tag, dt_size_send = smpi_datatype_size(datatype); extra->send_size = count*dt_size_send; TRACE_smpi_ptp_in(rank, rank, dst_traced, __FUNCTION__, extra); - TRACE_smpi_send(rank, rank, dst_traced,count*smpi_datatype_size(datatype)); + if (!TRACE_smpi_view_internals()) { + TRACE_smpi_send(rank, rank, dst_traced,count*smpi_datatype_size(datatype)); + } smpi_mpi_send(buf, count, datatype, dst, tag, comm); retval = MPI_SUCCESS; @@ -1816,10 +1820,11 @@ int PMPI_Gatherv(void *sendbuf, int sendcount, MPI_Datatype sendtype, int dt_size_recv = 1; if(!known) dt_size_recv = smpi_datatype_size(recvtype); + if((smpi_comm_rank(comm)==root)){ extra->recvcounts= xbt_malloc(size*sizeof(int)); for(i=0; i< size; i++)//copy data to avoid bad free extra->recvcounts[i] = recvcounts[i]*dt_size_recv; - + } TRACE_smpi_collective_in(rank, root_traced, __FUNCTION__,extra); smpi_mpi_gatherv(sendtmpbuf, sendtmpcount, sendtmptype, recvbuf, recvcounts, @@ -2019,9 +2024,11 @@ int PMPI_Scatterv(void *sendbuf, int *sendcounts, int *displs, int dt_size_send = 1; if(!known) dt_size_send = smpi_datatype_size(sendtype); + if((smpi_comm_rank(comm)==root)){ extra->sendcounts= xbt_malloc(size*sizeof(int)); for(i=0; i< size; i++)//copy data to avoid bad free extra->sendcounts[i] = sendcounts[i]*dt_size_send; + } extra->datatype2 = encode_datatype(recvtype, &known); int dt_size_recv = 1; if(!known) @@ -3094,20 +3101,47 @@ int PMPI_Attr_delete(MPI_Comm comm, int keyval) { } int PMPI_Attr_get(MPI_Comm comm, int keyval, void* attr_value, int* flag) { + static int one = 1; + static int zero = 0; + static int tag_ub = 1000000; + static int last_used_code = MPI_ERR_LASTCODE; + if (comm==MPI_COMM_NULL){ - *flag=0; + *flag = 0; return MPI_ERR_COMM; - } else if(keyval == MPI_TAG_UB||keyval == MPI_HOST||keyval == MPI_IO - ||keyval == MPI_WTIME_IS_GLOBAL||keyval == MPI_APPNUM - ||keyval == MPI_UNIVERSE_SIZE||keyval == MPI_LASTUSEDCODE){ + } + + switch (keyval) { + case MPI_HOST: + case MPI_IO: + case MPI_APPNUM: + *flag = 1; + *(int**)attr_value = &zero; + return MPI_SUCCESS; + + case MPI_UNIVERSE_SIZE: + *flag = 1; + *(int**)attr_value = &smpi_universe_size; + return MPI_SUCCESS; + + case MPI_LASTUSEDCODE: + *flag = 1; + *(int**)attr_value = &last_used_code; + return MPI_SUCCESS; + + case MPI_TAG_UB: *flag=1; - //FIXME : not ideal and leaky, but should not be called too much - int* res = xbt_new(int, 1); - *res=keyval; - *(int**)attr_value=res; + *(int**)attr_value = &tag_ub; return MPI_SUCCESS; - } else - return smpi_comm_attr_get(comm, keyval, attr_value, flag); + + case MPI_WTIME_IS_GLOBAL: + *flag = 1; + *(int**)attr_value = &one; + return MPI_SUCCESS; + + default: + return smpi_comm_attr_get(comm, keyval, attr_value, flag); + } } int PMPI_Attr_put(MPI_Comm comm, int keyval, void* attr_value) { @@ -3635,4 +3669,3 @@ int PMPI_Win_test(MPI_Win win, int *flag){ int PMPI_Win_unlock(int rank, MPI_Win win){ NOT_YET_IMPLEMENTED } -