Commit b4709f2b authored by robl's avatar robl
Browse files

panasas patch added a few files.

parent af4c1263
/* -*- Mode: C; c-basic-offset:4 ; -*- */
/*
*
* Copyright (C) 1997 University of Chicago.
* See COPYRIGHT notice in top-level directory.
*/
#include "ad_panfs.h"
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
void ADIOI_PANFS_ReadContig(ADIO_File fd, void *buf, int count,
MPI_Datatype datatype, int file_ptr_type,
ADIO_Offset offset, ADIO_Status *status,
int *error_code)
{
int err = -1, datatype_size, len;
static char myname[] = "ADIOI_PANFS_READCONTIG";
MPI_Type_size(datatype, &datatype_size);
len = datatype_size * count;
if (file_ptr_type == ADIO_INDIVIDUAL) {
offset = fd->fp_ind;
}
if (fd->fp_sys_posn != offset) {
err = lseek(fd->fd_sys, offset, SEEK_SET);
/* --BEGIN ERROR HANDLING-- */
if (err == -1) {
*error_code = MPIO_Err_create_code(MPI_SUCCESS,
MPIR_ERR_RECOVERABLE,
myname, __LINE__,
MPI_ERR_IO, "**io",
"**io %s", strerror(errno));
fd->fp_sys_posn = -1;
return;
}
/* --END ERROR HANDLING-- */
}
AD_PANFS_RETRY(read(fd->fd_sys, buf, len),err)
/* --BEGIN ERROR HANDLING-- */
if (err == -1) {
*error_code = MPIO_Err_create_code(MPI_SUCCESS,
MPIR_ERR_RECOVERABLE,
myname, __LINE__,
MPI_ERR_IO, "**io",
"**io %s", strerror(errno));
fd->fp_sys_posn = -1;
return;
}
/* --END ERROR HANDLING-- */
fd->fp_sys_posn = offset + err;
if (file_ptr_type == ADIO_INDIVIDUAL) {
fd->fp_ind += err;
}
#ifdef HAVE_STATUS_SET_BYTES
if (err != -1) MPIR_Status_set_bytes(status, datatype, err);
#endif
*error_code = MPI_SUCCESS;
}
/* -*- Mode: C; c-basic-offset:4 ; -*- */
/*
*
* Copyright (C) 2004 University of Chicago.
* See COPYRIGHT notice in top-level directory.
*/
#include "ad_panfs.h"
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
void ADIOI_PANFS_Resize(ADIO_File fd, ADIO_Offset size, int *error_code)
{
int err;
int myrank;
struct stat stat_buf;
static char myname[] = "ADIOI_PANFS_RESIZE";
MPI_Comm_rank(fd->comm, &myrank);
if (!myrank)
{
AD_PANFS_RETRY(ftruncate(fd->fd_sys,size),err);
MPI_Barrier(fd->comm);
}
else
{
MPI_Barrier(fd->comm);
AD_PANFS_RETRY(fstat(fd->fd_sys,&stat_buf),err);
if(((ADIO_Offset)stat_buf.st_size) != size)
{
/* This should never happen otherwise there is a coherency problem. */
FPRINTF(stderr, "%s: Rank %d: Resize failed: requested=%llu actual=%llu.\n",myname,myrank,size,stat_buf.st_size);
MPI_Abort(MPI_COMM_WORLD, 1);
}
}
/* --BEGIN ERROR HANDLING-- */
if (err == -1) {
*error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE,
myname, __LINE__, MPI_ERR_IO,
"**io", "**io %s", strerror(errno));
return;
}
/* --END ERROR HANDLING-- */
*error_code = MPI_SUCCESS;
}
/* -*- Mode: C; c-basic-offset:4 ; -*- */
/*
*
* Copyright (C) 2004 University of Chicago.
* See COPYRIGHT notice in top-level directory.
*/
#include "ad_panfs.h"
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
void ADIOI_PANFS_WriteContig(ADIO_File fd, void *buf, int count,
MPI_Datatype datatype, int file_ptr_type,
ADIO_Offset offset, ADIO_Status *status,
int *error_code)
{
int err = -1, datatype_size, len;
static char myname[] = "ADIOI_PANFS_WRITECONTIG";
MPI_Type_size(datatype, &datatype_size);
len = datatype_size * count;
if (file_ptr_type == ADIO_INDIVIDUAL) {
offset = fd->fp_ind;
}
if (fd->fp_sys_posn != offset) {
err = lseek(fd->fd_sys, offset, SEEK_SET);
/* --BEGIN ERROR HANDLING-- */
if (err == -1) {
*error_code = MPIO_Err_create_code(MPI_SUCCESS,
MPIR_ERR_RECOVERABLE,
myname, __LINE__,
MPI_ERR_IO, "**io",
"**io %s", strerror(errno));
fd->fp_sys_posn = -1;
return;
}
/* --END ERROR HANDLING-- */
}
AD_PANFS_RETRY(write(fd->fd_sys, buf, len),err)
/* --BEGIN ERROR HANDLING-- */
if (err == -1) {
*error_code = MPIO_Err_create_code(MPI_SUCCESS,
MPIR_ERR_RECOVERABLE,
myname, __LINE__,
MPI_ERR_IO, "**io",
"**io %s", strerror(errno));
fd->fp_sys_posn = -1;
return;
}
/* --END ERROR HANDLING-- */
fd->fp_sys_posn = offset + err;
if (file_ptr_type == ADIO_INDIVIDUAL) {
fd->fp_ind += err;
}
#ifdef HAVE_STATUS_SET_BYTES
if (err != -1 && status) MPIR_Status_set_bytes(status, datatype, err);
#endif
*error_code = MPI_SUCCESS;
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment