|
Packit Service |
c5cf8c |
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */
|
|
Packit Service |
c5cf8c |
/*
|
|
Packit Service |
c5cf8c |
*
|
|
Packit Service |
c5cf8c |
* Copyright (C) 1997 University of Chicago.
|
|
Packit Service |
c5cf8c |
* See COPYRIGHT notice in top-level directory.
|
|
Packit Service |
c5cf8c |
*/
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
#include "mpioimpl.h"
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
#ifdef HAVE_WEAK_SYMBOLS
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
#if defined(HAVE_PRAGMA_WEAK)
|
|
Packit Service |
c5cf8c |
#pragma weak MPI_File_iwrite_shared = PMPI_File_iwrite_shared
|
|
Packit Service |
c5cf8c |
#elif defined(HAVE_PRAGMA_HP_SEC_DEF)
|
|
Packit Service |
c5cf8c |
#pragma _HP_SECONDARY_DEF PMPI_File_iwrite_shared MPI_File_iwrite_shared
|
|
Packit Service |
c5cf8c |
#elif defined(HAVE_PRAGMA_CRI_DUP)
|
|
Packit Service |
c5cf8c |
#pragma _CRI duplicate MPI_File_iwrite_shared as PMPI_File_iwrite_shared
|
|
Packit Service |
c5cf8c |
/* end of weak pragmas */
|
|
Packit Service |
c5cf8c |
#elif defined(HAVE_WEAK_ATTRIBUTE)
|
|
Packit Service |
c5cf8c |
int MPI_File_iwrite_shared(MPI_File fh, const void *buf, int count, MPI_Datatype datatype,
|
|
Packit Service |
c5cf8c |
MPIO_Request * request)
|
|
Packit Service |
c5cf8c |
__attribute__ ((weak, alias("PMPI_File_iwrite_shared")));
|
|
Packit Service |
c5cf8c |
#endif
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
/* Include mapping from MPI->PMPI */
|
|
Packit Service |
c5cf8c |
#define MPIO_BUILD_PROFILING
|
|
Packit Service |
c5cf8c |
#include "mpioprof.h"
|
|
Packit Service |
c5cf8c |
#endif
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
/*@
|
|
Packit Service |
c5cf8c |
MPI_File_iwrite_shared - Nonblocking write using shared file pointer
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
Input Parameters:
|
|
Packit Service |
c5cf8c |
. fh - file handle (handle)
|
|
Packit Service |
c5cf8c |
. buf - initial address of buffer (choice)
|
|
Packit Service |
c5cf8c |
. count - number of elements in buffer (nonnegative integer)
|
|
Packit Service |
c5cf8c |
. datatype - datatype of each buffer element (handle)
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
Output Parameters:
|
|
Packit Service |
c5cf8c |
. request - request object (handle)
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
.N fortran
|
|
Packit Service |
c5cf8c |
@*/
|
|
Packit Service |
c5cf8c |
#ifdef HAVE_MPI_GREQUEST
|
|
Packit Service |
c5cf8c |
#include "mpiu_greq.h"
|
|
Packit Service |
c5cf8c |
#endif
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
int MPI_File_iwrite_shared(MPI_File fh, ROMIO_CONST void *buf, int count,
|
|
Packit Service |
c5cf8c |
MPI_Datatype datatype, MPIO_Request * request)
|
|
Packit Service |
c5cf8c |
{
|
|
Packit Service |
c5cf8c |
int error_code, buftype_is_contig, filetype_is_contig;
|
|
Packit Service |
c5cf8c |
ADIO_File adio_fh;
|
|
Packit Service |
c5cf8c |
ADIO_Offset incr, bufsize;
|
|
Packit Service |
c5cf8c |
MPI_Count datatype_size;
|
|
Packit Service |
c5cf8c |
ADIO_Status status;
|
|
Packit Service |
c5cf8c |
ADIO_Offset off, shared_fp;
|
|
Packit Service |
c5cf8c |
static char myname[] = "MPI_FILE_IWRITE_SHARED";
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
ROMIO_THREAD_CS_ENTER();
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
adio_fh = MPIO_File_resolve(fh);
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
/* --BEGIN ERROR HANDLING-- */
|
|
Packit Service |
c5cf8c |
MPIO_CHECK_FILE_HANDLE(adio_fh, myname, error_code);
|
|
Packit Service |
c5cf8c |
MPIO_CHECK_COUNT(adio_fh, count, myname, error_code);
|
|
Packit Service |
c5cf8c |
MPIO_CHECK_DATATYPE(adio_fh, datatype, myname, error_code);
|
|
Packit Service |
c5cf8c |
/* --END ERROR HANDLING-- */
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
MPI_Type_size_x(datatype, &datatype_size);
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
/* --BEGIN ERROR HANDLING-- */
|
|
Packit Service |
c5cf8c |
MPIO_CHECK_INTEGRAL_ETYPE(adio_fh, count, datatype_size, myname, error_code);
|
|
Packit Service |
c5cf8c |
MPIO_CHECK_FS_SUPPORTS_SHARED(adio_fh, myname, error_code);
|
|
Packit Service |
c5cf8c |
MPIO_CHECK_COUNT_SIZE(adio_fh, count, datatype_size, myname, error_code);
|
|
Packit Service |
c5cf8c |
/* --END ERROR HANDLING-- */
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
ADIOI_Datatype_iscontig(datatype, &buftype_is_contig);
|
|
Packit Service |
c5cf8c |
ADIOI_Datatype_iscontig(adio_fh->filetype, &filetype_is_contig);
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
ADIOI_TEST_DEFERRED(adio_fh, myname, &error_code);
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
incr = (count * datatype_size) / adio_fh->etype_size;
|
|
Packit Service |
c5cf8c |
ADIO_Get_shared_fp(adio_fh, incr, &shared_fp, &error_code);
|
|
Packit Service |
c5cf8c |
if (error_code != MPI_SUCCESS) {
|
|
Packit Service |
c5cf8c |
/* note: ADIO_Get_shared_fp should have set up error code already? */
|
|
Packit Service |
c5cf8c |
MPIO_Err_return_file(adio_fh, error_code);
|
|
Packit Service |
c5cf8c |
}
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
/* contiguous or strided? */
|
|
Packit Service |
c5cf8c |
if (buftype_is_contig && filetype_is_contig) {
|
|
Packit Service |
c5cf8c |
/* convert sizes to bytes */
|
|
Packit Service |
c5cf8c |
bufsize = datatype_size * count;
|
|
Packit Service |
c5cf8c |
off = adio_fh->disp + adio_fh->etype_size * shared_fp;
|
|
Packit Service |
c5cf8c |
if (!(adio_fh->atomicity))
|
|
Packit Service |
c5cf8c |
ADIO_IwriteContig(adio_fh, buf, count, datatype, ADIO_EXPLICIT_OFFSET,
|
|
Packit Service |
c5cf8c |
off, request, &error_code);
|
|
Packit Service |
c5cf8c |
else {
|
|
Packit Service |
c5cf8c |
/* to maintain strict atomicity semantics with other concurrent
|
|
Packit Service |
c5cf8c |
* operations, lock (exclusive) and call blocking routine */
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
if (adio_fh->file_system != ADIO_NFS)
|
|
Packit Service |
c5cf8c |
ADIOI_WRITE_LOCK(adio_fh, off, SEEK_SET, bufsize);
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
ADIO_WriteContig(adio_fh, buf, count, datatype, ADIO_EXPLICIT_OFFSET,
|
|
Packit Service |
c5cf8c |
off, &status, &error_code);
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
if (adio_fh->file_system != ADIO_NFS)
|
|
Packit Service |
c5cf8c |
ADIOI_UNLOCK(adio_fh, off, SEEK_SET, bufsize);
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
MPIO_Completed_request_create(&adio_fh, bufsize, &error_code, request);
|
|
Packit Service |
c5cf8c |
}
|
|
Packit Service |
c5cf8c |
} else
|
|
Packit Service |
c5cf8c |
ADIO_IwriteStrided(adio_fh, buf, count, datatype, ADIO_EXPLICIT_OFFSET,
|
|
Packit Service |
c5cf8c |
shared_fp, request, &error_code);
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
fn_exit:
|
|
Packit Service |
c5cf8c |
ROMIO_THREAD_CS_EXIT();
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
return error_code;
|
|
Packit Service |
c5cf8c |
}
|