Open MPI logo

Open MPI Development Mailing List Archives

  |   Home   |   Support   |   FAQ   |   all Development mailing list

From: Jeff Squyres (jsquyres_at_[hidden])
Date: 2005-09-23 08:32:42


Tim --

Doesn't this violate the "nothing should call MPI functions" rule?

I also ask because there's a bunch of places where we alloc temporary
buffers in the collectives -- should we be using whatever the back-end
to MPI_Alloc_mem is instead of malloc()?

(this would apply to both the basic and tuned collective components)

Begin forwarded message:

> From: twoodall_at_[hidden]
> Date: September 22, 2005 12:43:19 PM EDT
> To: svn-full_at_[hidden]
> Subject: [O-MPI svn-full] svn:open-mpi r7487 - trunk/ompi/mpi/c
> Reply-To: devel_at_[hidden]
>
> Author: twoodall
> Date: 2005-09-22 11:43:17 -0500 (Thu, 22 Sep 2005)
> New Revision: 7487
>
> Modified:
> trunk/ompi/mpi/c/sendrecv_replace.c
> Log:
> use MPI_Alloc_mem/MPI_Free_mem for internally allocated buffers
>
>
> Modified: trunk/ompi/mpi/c/sendrecv_replace.c
> ===================================================================
> --- trunk/ompi/mpi/c/sendrecv_replace.c 2005-09-22 16:41:34 UTC (rev
> 7486)
> +++ trunk/ompi/mpi/c/sendrecv_replace.c 2005-09-22 16:43:17 UTC (rev
> 7487)
> @@ -86,8 +86,8 @@
> /* setup a buffer for recv */
> ompi_convertor_get_packed_size( &convertor, &packed_size );
> if( packed_size > sizeof(recv_data) ) {
> - iov.iov_base = (caddr_t)malloc(packed_size);
> - if(iov.iov_base == NULL) {
> + rc = MPI_Alloc_mem(packed_size, MPI_INFO_NULL,
> &iov.iov_base);
> + if(OMPI_SUCCESS != rc) {
> OMPI_ERRHANDLER_RETURN(OMPI_ERR_OUT_OF_RESOURCE,
> comm, MPI_ERR_BUFFER, FUNC_NAME);
> }
> } else {
> @@ -117,7 +117,7 @@
>
> /* release resources */
> if(packed_size > sizeof(recv_data)) {
> - free(iov.iov_base);
> + MPI_Free_mem(iov.iov_base);
> }
> OBJ_DESTRUCT(&convertor);
> return MPI_SUCCESS;
>
> _______________________________________________
> svn-full mailing list
> svn-full_at_[hidden]
> http://www.open-mpi.org/mailman/listinfo.cgi/svn-full
>

-- 
{+} Jeff Squyres
{+} The Open MPI Project
{+} http://www.open-mpi.org/