📄 mpich-1.2.6-lustre.patch
字号:
+ len = ADIOI_MIN(alloc_size-done, ADIOI_PREALLOC_BUFSZ);+ ADIO_WriteContig(fd, buf, len, MPI_BYTE, ADIO_EXPLICIT_OFFSET, + done, &status, error_code);+ if (*error_code != MPI_SUCCESS) return;+ done += len; + }+ }+ ADIOI_Free(buf);+ if (fd->fp_sys_posn != -1) + lseek(fd->fd_sys, fd->fp_sys_posn, SEEK_SET);+ *error_code = MPI_SUCCESS;+ break;++ case ADIO_FCNTL_SET_IOMODE:+ /* for implementing PFS I/O modes. will not occur in MPI-IO+ implementation.*/+ if (fd->iomode != fcntl_struct->iomode) {+ fd->iomode = fcntl_struct->iomode;+ MPI_Barrier(MPI_COMM_WORLD);+ }+ *error_code = MPI_SUCCESS;+ break;++ case ADIO_FCNTL_SET_ATOMICITY:+ fd->atomicity = (fcntl_struct->atomicity == 0) ? 0 : 1;+ *error_code = MPI_SUCCESS;+ break;++ default:+ FPRINTF(stderr, "Unknown flag passed to ADIOI_LUSTRE_Fcntl\n");+ MPI_Abort(MPI_COMM_WORLD, 1);+ }+}diff -r -u --new-file mpich-1.2.6/romio/adio/ad_lustre/ad_lustre_flush.c mpich-1.2.6/romio/adio/ad_lustre/ad_lustre_flush.c--- mpich-1.2.6/romio/adio/ad_lustre/ad_lustre_flush.c 1969-12-31 19:00:00.000000000 -0500+++ mpich-1.2.6/romio/adio/ad_lustre/ad_lustre_flush.c 2005-12-06 11:54:37.903128261 -0500@@ -0,0 +1,14 @@+/* -*- Mode: C; c-basic-offset:4 ; -*- */+/* + * $Id: ad_lustre_flush.c,v 1.1.1.1 2004/11/04 11:03:38 liam Exp $ + *+ * Copyright (C) 1997 University of Chicago. + * See COPYRIGHT notice in top-level directory.+ */++#include "ad_lustre.h"++void ADIOI_LUSTRE_Flush(ADIO_File fd, int *error_code)+{+ ADIOI_GEN_Flush(fd, error_code);+}diff -r -u --new-file mpich-1.2.6/romio/adio/ad_lustre/ad_lustre.h mpich-1.2.6/romio/adio/ad_lustre/ad_lustre.h--- mpich-1.2.6/romio/adio/ad_lustre/ad_lustre.h 1969-12-31 19:00:00.000000000 -0500+++ mpich-1.2.6/romio/adio/ad_lustre/ad_lustre.h 2005-12-06 11:54:37.891129861 -0500@@ -0,0 +1,36 @@+/* -*- Mode: C; c-basic-offset:4 ; -*- */+/* + * $Id: ad_lustre.h,v 1.2 2005/07/07 14:38:17 liam Exp $ + *+ * Copyright (C) 1997 University of Chicago. + * See COPYRIGHT notice in top-level directory.+ */++#ifndef AD_UNIX_INCLUDE+#define AD_UNIX_INCLUDE++/* temp*/+#define HAVE_ASM_TYPES_H 1++#include <unistd.h>+#include <linux/types.h>+#include <fcntl.h>+#include <sys/ioctl.h>+#include "lustre/lustre_user.h"+#include "adio.h"++#ifndef NO_AIO+#ifdef AIO_SUN+#include <sys/asynch.h>+#else+#include <aio.h>+#ifdef NEEDS_ADIOCB_T+typedef struct adiocb adiocb_t;+#endif+#endif+#endif++int ADIOI_LUSTRE_aio(ADIO_File fd, void *buf, int len, ADIO_Offset offset,+ int wr, void *handle);++#endifdiff -r -u --new-file mpich-1.2.6/romio/adio/ad_lustre/ad_lustre_hints.c mpich-1.2.6/romio/adio/ad_lustre/ad_lustre_hints.c--- mpich-1.2.6/romio/adio/ad_lustre/ad_lustre_hints.c 1969-12-31 19:00:00.000000000 -0500+++ mpich-1.2.6/romio/adio/ad_lustre/ad_lustre_hints.c 2005-12-06 11:54:37.904128127 -0500@@ -0,0 +1,130 @@+/* -*- Mode: C; c-basic-offset:4 ; -*- */+/* + * $Id: ad_lustre_hints.c,v 1.2 2005/07/07 14:38:17 liam Exp $ + *+ * Copyright (C) 1997 University of Chicago. + * See COPYRIGHT notice in top-level directory.+ */++#include "ad_lustre.h"++void ADIOI_LUSTRE_SetInfo(ADIO_File fd, MPI_Info users_info, int *error_code)+{+ char *value, *value_in_fd;+ int flag, tmp_val, str_factor=-1, str_unit=0, start_iodev=-1;+ struct lov_user_md lum = { 0 };+ int err, myrank, fd_sys, perm, amode, old_mask;++ if ( (fd->info) == MPI_INFO_NULL) {+ /* This must be part of the open call. can set striping parameters + if necessary. */ + MPI_Info_create(&(fd->info));+ + /* has user specified striping or server buffering parameters + and do they have the same value on all processes? */+ if (users_info != MPI_INFO_NULL) {+ value = (char *) ADIOI_Malloc((MPI_MAX_INFO_VAL+1)*sizeof(char));++ MPI_Info_get(users_info, "striping_factor", MPI_MAX_INFO_VAL, + value, &flag);+ if (flag) {+ str_factor=atoi(value);+ tmp_val = str_factor;+ MPI_Bcast(&tmp_val, 1, MPI_INT, 0, fd->comm);+ if (tmp_val != str_factor) {+ FPRINTF(stderr, "ADIOI_LUSTRE_SetInfo: the value for key \"striping_factor\" must be the same on all processes\n");+ MPI_Abort(MPI_COMM_WORLD, 1);+ }+ }++ MPI_Info_get(users_info, "striping_unit", MPI_MAX_INFO_VAL, + value, &flag);+ if (flag) {+ str_unit=atoi(value);+ tmp_val = str_unit;+ MPI_Bcast(&tmp_val, 1, MPI_INT, 0, fd->comm);+ if (tmp_val != str_unit) {+ FPRINTF(stderr, "ADIOI_LUSTRE_SetInfo: the value for key \"striping_unit\" must be the same on all processes\n");+ MPI_Abort(MPI_COMM_WORLD, 1);+ }+ }++ MPI_Info_get(users_info, "start_iodevice", MPI_MAX_INFO_VAL, + value, &flag);+ if (flag) {+ start_iodev=atoi(value);+ tmp_val = start_iodev;+ MPI_Bcast(&tmp_val, 1, MPI_INT, 0, fd->comm);+ if (tmp_val != start_iodev) {+ FPRINTF(stderr, "ADIOI_LUSTRE_SetInfo: the value for key \"start_iodevice\" must be the same on all processes\n");+ MPI_Abort(MPI_COMM_WORLD, 1);+ }+ }++ /* if user has specified striping info, process 0 tries to set it */+ if ((str_factor > 0) || (str_unit > 0) || (start_iodev >= 0)) {+ MPI_Comm_rank(fd->comm, &myrank);+ if (!myrank) {+ if (fd->perm == ADIO_PERM_NULL) {+ old_mask = umask(022);+ umask(old_mask);+ perm = old_mask ^ 0666;+ }+ else perm = fd->perm;++ amode = 0;+ if (fd->access_mode & ADIO_CREATE)+ amode = amode | O_CREAT;+ if (fd->access_mode & ADIO_RDWR ||+ (fd->access_mode & ADIO_RDONLY &&+ fd->access_mode & ADIO_WRONLY))+ amode = amode | O_RDWR;+ else if (fd->access_mode & ADIO_WRONLY)+ amode = amode | O_WRONLY;+ else if (fd->access_mode & ADIO_RDONLY)+ amode = amode | O_RDONLY;+ if (fd->access_mode & ADIO_EXCL)+ amode = amode | O_EXCL;++ /* we need to create file so ensure this is set */+ amode = amode | O_LOV_DELAY_CREATE | O_CREAT;++ fd_sys = open(fd->filename, amode, perm);+ if (fd_sys == -1) { + if (errno != EEXIST) + FPRINTF(stderr, "ADIOI_LUSTRE_SetInfo: Failure to open file %s %d %d\n",strerror(errno), amode, perm);+ } else {+ lum.lmm_magic = LOV_USER_MAGIC;+ lum.lmm_pattern = 0;+ lum.lmm_stripe_size = str_unit;+ lum.lmm_stripe_count = str_factor;+ lum.lmm_stripe_offset = start_iodev;++ err = ioctl(fd_sys, LL_IOC_LOV_SETSTRIPE, &lum);+ if (err == -1 && errno != EEXIST) { + FPRINTF(stderr, "ADIOI_LUSTRE_SetInfo: Failure to set stripe info %s \n",strerror(errno));+ }++ close(fd_sys);+ }++ }+ MPI_Barrier(fd->comm);+ }++ ADIOI_Free(value);+ }+ + /* set the values for collective I/O and data sieving parameters */+ ADIOI_GEN_SetInfo(fd, users_info, error_code);+ }+ + else {+ /* The file has been opened previously and fd->fd_sys is a valid+ file descriptor. cannot set striping parameters now. */+ + /* set the values for collective I/O and data sieving parameters */+ ADIOI_GEN_SetInfo(fd, users_info, error_code);++ }+ + *error_code = MPI_SUCCESS;+}diff -r -u --new-file mpich-1.2.6/romio/adio/ad_lustre/ad_lustre_iread.c mpich-1.2.6/romio/adio/ad_lustre/ad_lustre_iread.c--- mpich-1.2.6/romio/adio/ad_lustre/ad_lustre_iread.c 1969-12-31 19:00:00.000000000 -0500+++ mpich-1.2.6/romio/adio/ad_lustre/ad_lustre_iread.c 2005-12-06 11:54:37.904128127 -0500@@ -0,0 +1,106 @@+/* -*- Mode: C; c-basic-offset:4 ; -*- */+/* + * $Id: ad_lustre_iread.c,v 1.1.1.1 2004/11/04 11:03:38 liam Exp $ + *+ * Copyright (C) 1997 University of Chicago. + * See COPYRIGHT notice in top-level directory.+ */++#include "ad_lustre.h"++void ADIOI_LUSTRE_IreadContig(ADIO_File fd, void *buf, int count, + MPI_Datatype datatype, int file_ptr_type,+ ADIO_Offset offset, ADIO_Request *request, int *error_code) +{+ int len, typesize;+#ifdef NO_AIO+ ADIO_Status status;+#else+ int err=-1;+#if defined(MPICH2) || !defined(PRINT_ERR_MSG)+ static char myname[] = "ADIOI_LUSTRE_IREADCONTIG";+#endif+#endif++ (*request) = ADIOI_Malloc_request();+ (*request)->optype = ADIOI_READ;+ (*request)->fd = fd;+ (*request)->datatype = datatype;++ MPI_Type_size(datatype, &typesize);+ len = count * typesize;++#ifdef NO_AIO+ /* HP, FreeBSD, Linux */+ /* no support for nonblocking I/O. Use blocking I/O. */++ ADIOI_LUSTRE_ReadContig(fd, buf, len, MPI_BYTE, file_ptr_type, offset, + &status, error_code); + (*request)->queued = 0;+#ifdef HAVE_STATUS_SET_BYTES+ if (*error_code == MPI_SUCCESS) {+ MPI_Get_elements(&status, MPI_BYTE, &len);+ (*request)->nbytes = len;+ }+#endif++#else+ if (file_ptr_type == ADIO_INDIVIDUAL) offset = fd->fp_ind;+ err = ADIOI_LUSTRE_aio(fd, buf, len, offset, 0, &((*request)->handle));+ if (file_ptr_type == ADIO_INDIVIDUAL) fd->fp_ind += len;++ (*request)->queued = 1;+ ADIOI_Add_req_to_list(request);++ if (err == -1) {+#ifdef MPICH2+ *error_code = MPIR_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, myname, __LINE__, MPI_ERR_IO, "**io",+ "**io %s", strerror(errno));+ return;+#elif defined(PRINT_ERR_MSG)+ *error_code = MPI_ERR_UNKNOWN;+#else /* MPICH-1 */+ *error_code = MPIR_Err_setmsg(MPI_ERR_IO, MPIR_ADIO_ERROR,+ myname, "I/O Error", "%s", strerror(errno));+ ADIOI_Error(fd, *error_code, myname); +#endif+ }+ else *error_code = MPI_SUCCESS;+#endif /* NO_AIO */++ fd->fp_sys_posn = -1; /* set it to null. */+ fd->async_count++;+}++++void ADIOI_LUSTRE_IreadStrided(ADIO_File fd, void *buf, int count, + MPI_Datatype datatype, int file_ptr_type,+ ADIO_Offset offset, ADIO_Request *request, int+ *error_code)+{+ ADIO_Status status;+#ifdef HAVE_STATUS_SET_BYTES+ int typesize;+#endif++ *request = ADIOI_Malloc_request();+ (*request)->optype = ADIOI_READ;+ (*request)->fd = fd;+ (*request)->datatype = datatype;+ (*request)->queued = 0;+ (*request)->handle = 0;++/* call the blocking version. It is faster because it does data sieving. */+ ADIOI_LUSTRE_ReadStrided(fd, buf, count, datatype, file_ptr_type, + offset, &status, error_code); ++ fd->async_count++;++#ifdef HAVE_STATUS_SET_BYTES+ if (*error_code == MPI_SUCCESS) {+ MPI_Type_size(datatype, &typesize);+ (*request)->nbytes = count * typesize;+ }+#endif+}diff -r -u --new-file mpich-1.2.6/romio/adio/ad_lustre/ad_lustre_iwrite.c mpich-1.2.6/romio/adio/ad_lustre/ad_lustre_iwrite.c--- mpich-1.2.6/romio/adio/ad_lustre/ad_lustre_iwrite.c 1969-12-31 19:00:00.000000000 -0500+++ mpich-1.2.6/romio/adio/ad_lustre/ad_lustre_iwrite.c 2005-12-06 11:54:37.906127861 -0500@@ -0,0 +1,268 @@+/* -*- Mode: C; c-basic-offset:4 ; -*- */+/* + * $Id: ad_lustre_iwrite.c,v 1.1.1.1 2004/11/04 11:03:38 liam Exp $ + *+ * Copyright (C) 1997 University of Chicago. + * See COPYRIGHT notice in top-level directory.+ */++#include "ad_lustre.h"++void ADIOI_LUSTRE_IwriteContig(ADIO_File fd, void *buf, int count, + MPI_Datatype datatype, int file_ptr_type,+ ADIO_Offset offset, ADIO_Request *request, int *error_code) +{+ int len, typesize;+#ifdef NO_AIO+ ADIO_Status status;+#else+ int err=-1;+#if defined(MPICH2) || !defined(PRINT_ERR_MSG)+ static char myname[] = "ADIOI_LUSTRE_IWRITECONTIG";+#endif+#endif++ *request = ADIOI_Malloc_request();
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -