⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mpich-1.2.6-lustre.patch

📁 lustre 1.6.5 source code
💻 PATCH
📖 第 1 页 / 共 5 页
字号:
+    (*request)->optype = ADIOI_WRITE;+    (*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_WriteContig(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, 1, &((*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_IwriteStrided(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_WRITE;+    (*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_WriteStrided(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+}+++/* This function is for implementation convenience. It is not user-visible.+   It takes care of the differences in the interface for nonblocking I/O+   on various Unix machines! If wr==1 write, wr==0 read. */++int ADIOI_LUSTRE_aio(ADIO_File fd, void *buf, int len, ADIO_Offset offset,+		  int wr, void *handle)+{+    int err=-1, fd_sys;++#ifndef NO_AIO+    int error_code;+#ifdef AIO_SUN +    aio_result_t *result;+#else+    struct aiocb *aiocbp;+#endif+#endif++    fd_sys = fd->fd_sys;++#ifdef AIO_SUN+    result = (aio_result_t *) ADIOI_Malloc(sizeof(aio_result_t));+    result->aio_return = AIO_INPROGRESS;+    if (wr) err = aiowrite(fd_sys, buf, len, offset, SEEK_SET, result); +    else err = aioread(fd_sys, buf, len, offset, SEEK_SET, result);++    if (err == -1) {+	if (errno == EAGAIN) { +       /* the man pages say EPROCLIM, but in reality errno is set to EAGAIN! */++        /* exceeded the max. no. of outstanding requests.+           complete all previous async. requests and try again.*/++	    ADIOI_Complete_async(&error_code);+	    if (wr) err = aiowrite(fd_sys, buf, len, offset, SEEK_SET, result); +	    else err = aioread(fd_sys, buf, len, offset, SEEK_SET, result);++	    while (err == -1) {+		if (errno == EAGAIN) {+                    /* sleep and try again */+                    sleep(1);+		    if (wr) err = aiowrite(fd_sys, buf, len, offset, SEEK_SET, result); +		    else err = aioread(fd_sys, buf, len, offset, SEEK_SET, result);+		}+                else {+                    FPRINTF(stderr, "Unknown errno %d in ADIOI_LUSTRE_aio\n", errno);+                    MPI_Abort(MPI_COMM_WORLD, 1);+                }+	    }+	}+        else {+            FPRINTF(stderr, "Unknown errno %d in ADIOI_LUSTRE_aio\n", errno);+            MPI_Abort(MPI_COMM_WORLD, 1);+        }+    }++    *((aio_result_t **) handle) = result;+#endif++#ifdef NO_FD_IN_AIOCB+/* IBM */+    aiocbp = (struct aiocb *) ADIOI_Malloc(sizeof(struct aiocb));+    aiocbp->aio_whence = SEEK_SET;+    aiocbp->aio_offset = offset;+    aiocbp->aio_buf = buf;+    aiocbp->aio_nbytes = len;+    if (wr) err = aio_write(fd_sys, aiocbp);+    else err = aio_read(fd_sys, aiocbp);++    if (err == -1) {+	if (errno == EAGAIN) {+        /* exceeded the max. no. of outstanding requests.+          complete all previous async. requests and try again. */++	    ADIOI_Complete_async(&error_code);+	    if (wr) err = aio_write(fd_sys, aiocbp);+	    else err = aio_read(fd_sys, aiocbp);++            while (err == -1) {+                if (errno == EAGAIN) {+                    /* sleep and try again */+                    sleep(1);+		    if (wr) err = aio_write(fd_sys, aiocbp);+		    else err = aio_read(fd_sys, aiocbp);+		}+                else {+                    FPRINTF(stderr, "Unknown errno %d in ADIOI_LUSTRE_aio\n", errno);+                    MPI_Abort(MPI_COMM_WORLD, 1);+                }+            }+	}+        else {+            FPRINTF(stderr, "Unknown errno %d in ADIOI_LUSTRE_aio\n", errno);+            MPI_Abort(MPI_COMM_WORLD, 1);+        }+    }++    *((struct aiocb **) handle) = aiocbp;++#elif (!defined(NO_AIO) && !defined(AIO_SUN))+/* DEC, SGI IRIX 5 and 6 */++    aiocbp = (struct aiocb *) ADIOI_Calloc(sizeof(struct aiocb), 1);+    aiocbp->aio_fildes = fd_sys;+    aiocbp->aio_offset = offset;+    aiocbp->aio_buf = buf;+    aiocbp->aio_nbytes = len;++#ifdef AIO_PRIORITY_DEFAULT+/* DEC */+    aiocbp->aio_reqprio = AIO_PRIO_DFL;   /* not needed in DEC Unix 4.0 */+    aiocbp->aio_sigevent.sigev_signo = 0;+#else+    aiocbp->aio_reqprio = 0;+#endif++#ifdef AIO_SIGNOTIFY_NONE+/* SGI IRIX 6 */+    aiocbp->aio_sigevent.sigev_notify = SIGEV_NONE;+#else+    aiocbp->aio_sigevent.sigev_signo = 0;+#endif++    if (wr) err = aio_write(aiocbp);+    else err = aio_read(aiocbp);++    if (err == -1) {+	if (errno == EAGAIN) {+        /* exceeded the max. no. of outstanding requests.+           complete all previous async. requests and try again. */++	    ADIOI_Complete_async(&error_code);+	    if (wr) err = aio_write(aiocbp);+	    else err = aio_read(aiocbp);++	    while (err == -1) {+		if (errno == EAGAIN) {+		    /* sleep and try again */+		    sleep(1);+		    if (wr) err = aio_write(aiocbp);+		    else err = aio_read(aiocbp);+		}+		else {+		    FPRINTF(stderr, "Unknown errno %d in ADIOI_LUSTRE_aio\n", errno);+		    MPI_Abort(MPI_COMM_WORLD, 1);+		}+	    }+        }+	else {+	    FPRINTF(stderr, "Unknown errno %d in ADIOI_LUSTRE_aio\n", errno);+	    MPI_Abort(MPI_COMM_WORLD, 1);+	}+    }++    *((struct aiocb **) handle) = aiocbp;+#endif++    return err;+}diff -r -u --new-file mpich-1.2.6/romio/adio/ad_lustre/ad_lustre_open.c mpich-1.2.6/romio/adio/ad_lustre/ad_lustre_open.c--- mpich-1.2.6/romio/adio/ad_lustre/ad_lustre_open.c	1969-12-31 19:00:00.000000000 -0500+++ mpich-1.2.6/romio/adio/ad_lustre/ad_lustre_open.c	2005-12-06 11:54:37.906127861 -0500@@ -0,0 +1,100 @@+/* -*- Mode: C; c-basic-offset:4 ; -*- */+/* + *   $Id: ad_lustre_open.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_Open(ADIO_File fd, int *error_code)+{+    int perm, old_mask, amode;+    struct lov_user_md lum = { 0 };+    char *value;++#if defined(MPICH2) || !defined(PRINT_ERR_MSG)+    static char myname[] = "ADIOI_LUSTRE_OPEN";+#endif++    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_RDONLY)+	amode = amode | O_RDONLY;+    if (fd->access_mode & ADIO_WRONLY)+	amode = amode | O_WRONLY;+    if (fd->access_mode & ADIO_RDWR)+	amode = amode | O_RDWR;+    if (fd->access_mode & ADIO_EXCL)+	amode = amode | O_EXCL;++    fd->fd_sys = open(fd->filename, amode, perm);++    if (fd->fd_sys != -1) {+        int err;++        value = (char *) ADIOI_Malloc((MPI_MAX_INFO_VAL+1)*sizeof(char));++        /* get file striping information and set it in info */+        lum.lmm_magic = LOV_USER_MAGIC;+        err = ioctl(fd->fd_sys, LL_IOC_LOV_GETSTRIPE, (void *) &lum);++        if (!err) {+            sprintf(value, "%d", lum.lmm_stripe_size);+            MPI_Info_set(fd->info, "striping_unit", value);++            sprintf(value, "%d", lum.lmm_stripe_count);+            MPI_Info_set(fd->info, "striping_factor", value);++            sprintf(value, "%d", lum.lmm_stripe_offset);+            MPI_Info_set(fd->info, "start_iodevice", value);+        }+        ADIOI_Free(value);++        if (fd->access_mode & ADIO_APPEND)+            fd->fp_ind = fd->fp_sys_posn = lseek(fd->fd_sys, 0, SEEK_END);+    }+++    if ((fd->fd_sys != -1) && (fd->access_mode & ADIO_APPEND))+	fd->fp_ind = fd->fp_sys_posn = lseek(fd->fd_sys, 0, SEEK_END);++    if (fd->fd_sys == -1) {+#ifdef MPICH2+	if (errno == ENAMETOOLONG)+	    *error_code = MPIR_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, myname, __LINE__, MPI_ERR_BAD_FILE, "**filenamelong", "**filenamelong %s %d", fd->filename, strlen(fd->filename) );+	else if (errno == ENOENT)+	    *error_code = MPIR_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, myname, __LINE__, MPI_ERR_NO_SUCH_FILE, "**filenoexist", "**filenoexist %s", fd->filename );+	else if (errno == ENOTDIR || errno == ELOOP)+	    *error_code = MPIR_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, myname, __LINE__, MPI_ERR_BAD_FILE, "**filenamedir", "**filenamedir %s", fd->filename );+	else if (errno == EACCES) {+	    *error_code = MPIR_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, myname, __LINE__, MPI_ERR_ACCESS, "**fileaccess", "**fileaccess %s", +					       fd->filename );+	}+	else if (errno == EROFS) {+	    /* Read only file or file system and write access requested */+	    *error_code = MPIR_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, myname, __LINE__, MPI_ERR_READ_ONLY, "**ioneedrd", 0 );+	}+	else {+	    *error_code = MPIR_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, myname, __LINE__, MPI_ERR_IO, "**io",+	    "**io %s", strerror(errno));+	}+#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(ADIO_FILE_NULL, *error_code, myname);	    +#endif+    }+    else *error_code = MPI_SUCCESS;+}diff -r -u --new-file mpich-1.2.6/romio/adio/ad_lustre/ad_lustre_rdcoll.c mpich-1.2.6/romio/adio/ad_lustre/ad_lustre_rdcoll.c--- mpich-1.2.6/romio/adio/ad_lustre/ad_lustre_rdcoll.c	1969-12-31 19:00:00.000000000 -0500+++ mpich-1.2.6/romio/adio/ad_lustre/ad_lustre_rdcoll.c	2005-12-06 11:54:37.907127727 -0500@@ -0,0 +1,18 @@+/* -*- Mode: C; c-basic-offset:4 ; -*- */+/* + *   $Id: ad_lustre_rdcoll.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_ReadStridedColl(ADIO_File fd, void *buf, int count,+                       MPI_Datatype datatype, int file_ptr_type,+                       ADIO_Offset offset, ADIO_Status *status, int+                       *error_code)+{

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -