diff --git a/ompi/mca/fs/gpfs/Makefile.am b/ompi/mca/fs/gpfs/Makefile.am index a54c8e7421..748d868b49 100644 --- a/ompi/mca/fs/gpfs/Makefile.am +++ b/ompi/mca/fs/gpfs/Makefile.am @@ -33,14 +33,9 @@ endif fs_gpfs_sources = \ fs_gpfs_component.c \ - fs_gpfs_file_close.c \ - fs_gpfs_file_delete.c \ - fs_gpfs_file_get_size.c \ fs_gpfs_file_open.c \ fs_gpfs_file_set_info.c\ - fs_gpfs_file_get_info.c\ - fs_gpfs_file_set_size.c \ - fs_gpfs_file_sync.c \ + fs_gpfs_file_get_info.c\ fs_gpfs.c \ fs_gpfs.h diff --git a/ompi/mca/fs/gpfs/fs_gpfs.c b/ompi/mca/fs/gpfs/fs_gpfs.c index dda05b8473..6663b10a67 100644 --- a/ompi/mca/fs/gpfs/fs_gpfs.c +++ b/ompi/mca/fs/gpfs/fs_gpfs.c @@ -90,7 +90,7 @@ mca_fs_gpfs_component_file_query (ompio_file_t *fh, int *priority) tmp = strchr (fh->f_filename, ':'); if (!tmp) { if (OMPIO_ROOT == fh->f_rank) { - fh->f_fstype = mca_fs_base_get_fstype ( fh->f_filename ); + fh->f_fstype = mca_fs_base_get_fstype ( (char *) fh->f_filename ); } fh->f_comm->c_coll->coll_bcast (&(fh->f_fstype), 1, diff --git a/ompi/mca/fs/gpfs/fs_gpfs.h b/ompi/mca/fs/gpfs/fs_gpfs.h index d8eae9c4cf..d81bc1ce58 100644 --- a/ompi/mca/fs/gpfs/fs_gpfs.h +++ b/ompi/mca/fs/gpfs/fs_gpfs.h @@ -35,11 +35,11 @@ BEGIN_C_DECLS int mca_fs_gpfs_component_init_query(bool enable_progress_threads, bool enable_mpi_threads); struct mca_fs_base_module_1_0_0_t * -mca_fs_gpfs_component_file_query(mca_io_ompio_file_t *fh, int *priority); -int mca_fs_gpfs_component_file_unquery(mca_io_ompio_file_t *file); +mca_fs_gpfs_component_file_query(ompio_file_t *fh, int *priority); +int mca_fs_gpfs_component_file_unquery(ompio_file_t *file); -int mca_fs_gpfs_module_init(mca_io_ompio_file_t *file); -int mca_fs_gpfs_module_finalize(mca_io_ompio_file_t *file); +int mca_fs_gpfs_module_init(ompio_file_t *file); +int mca_fs_gpfs_module_finalize(ompio_file_t *file); OMPI_MODULE_DECLSPEC extern mca_fs_base_component_2_0_0_t mca_fs_gpfs_component; /* @@ -48,22 +48,22 @@ OMPI_MODULE_DECLSPEC extern mca_fs_base_component_2_0_0_t mca_fs_gpfs_component; * ****************************************************************** */ -int mca_fs_gpfs_file_open(struct ompi_communicator_t *comm, char *filename, - int amode, struct ompi_info_t *info, struct mca_io_ompio_file_t *fh); -int mca_fs_gpfs_file_close(struct mca_io_ompio_file_t *fh); +int mca_fs_gpfs_file_open(struct ompi_communicator_t *comm, const char *filename, + int amode, struct opal_info_t *info, struct ompio_file_t *fh); +int mca_fs_gpfs_file_close(struct ompio_file_t *fh); int mca_fs_gpfs_file_delete(char *filename, struct ompi_info_t *info); -int mca_fs_gpfs_file_set_size(struct mca_io_ompio_file_t *fh, +int mca_fs_gpfs_file_set_size(struct ompio_file_t *fh, OMPI_MPI_OFFSET_TYPE size); -int mca_fs_gpfs_file_get_size(struct mca_io_ompio_file_t *fh, +int mca_fs_gpfs_file_get_size(struct ompio_file_t *fh, OMPI_MPI_OFFSET_TYPE * size); int mca_fs_gpfs_file_get_amode(struct ompi_file_t *fh, int *amode); -int mca_fs_gpfs_file_set_info(struct mca_io_ompio_file_t *fh, +int mca_fs_gpfs_file_set_info(struct ompio_file_t *fh, struct ompi_info_t *info); -int mca_fs_gpfs_file_get_info(struct mca_io_ompio_file_t *fh, +int mca_fs_gpfs_file_get_info(struct ompio_file_t *fh, struct ompi_info_t **info_used); int mca_fs_gpfs_prefetch_hints(int access_mode, - mca_io_ompio_file_t *fh, struct ompi_info_t *info); -int mca_fs_gpfs_io_selection(mca_io_ompio_file_t *fh, + ompio_file_t *fh, struct ompi_info_t *info); +int mca_fs_gpfs_io_selection(ompio_file_t *fh, struct ompi_info_t *info, struct ompi_info_t *info_selected); int mca_fs_gpfs_file_sync(struct ompi_file_t *fh); //CN: Is mca_fs_gpfs_file_seek needed at all. Not used anywhere! diff --git a/ompi/mca/fs/gpfs/fs_gpfs_file_get_info.c b/ompi/mca/fs/gpfs/fs_gpfs_file_get_info.c index 008acced01..622335d573 100644 --- a/ompi/mca/fs/gpfs/fs_gpfs_file_get_info.c +++ b/ompi/mca/fs/gpfs/fs_gpfs_file_get_info.c @@ -1,48 +1,55 @@ -/* - * Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana - * University Research and Technology - * Corporation. All rights reserved. - * Copyright (c) 2004-2011 The University of Tennessee and The University - * of Tennessee Research Foundation. All rights - * reserved. - * Copyright (c) 2004-2015 High Performance Computing Center Stuttgart, - * University of Stuttgart. All rights reserved. - * Copyright (c) 2004-2005 The Regents of the University of California. - * All rights reserved. - * Copyright (c) 2008-2011 University of Houston. All rights reserved. - * $COPYRIGHT$ - * - * Additional copyrights may follow - * - * $HEADER$ - */ - -#include "ompi_config.h" -#include "fs_gpfs.h" -#include "mpi.h" -#include "ompi/constants.h" -#include "ompi/mca/fs/fs.h" - -#include -#include - -#include -#include -#include -#include - -/* - * file_get_info_gpfs - * - * Function: - get_info of a file - * Accepts: - same arguments as MPI_File_get_info() - * Returns: - new info object - */ - - int mca_fs_gpfs_file_get_info(mca_io_ompio_file_t *fh, - ompi_info_t **info_used) { - fprintf(stderr, "GPFS GET INFO\n"); - int ret = OMPI_SUCCESS; - ret = MPI_Info_dup(fh->f_info, *info_used); - return ret; -} \ No newline at end of file +/* + * Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana + * University Research and Technology + * Corporation. All rights reserved. + * Copyright (c) 2004-2011 The University of Tennessee and The University + * of Tennessee Research Foundation. All rights + * reserved. + * Copyright (c) 2004-2015 High Performance Computing Center Stuttgart, + * University of Stuttgart. All rights reserved. + * Copyright (c) 2004-2005 The Regents of the University of California. + * All rights reserved. + * Copyright (c) 2008-2011 University of Houston. All rights reserved. + * $COPYRIGHT$ + * + * Additional copyrights may follow + * + * $HEADER$ + */ + +#include "ompi_config.h" +#include "fs_gpfs.h" +#include "mpi.h" +#include "ompi/constants.h" +#include "ompi/mca/fs/fs.h" + +#include +#include + +#include +#include +#include +#include + +/* + * file_get_info_gpfs + * + * Function: - get_info of a file + * Accepts: - same arguments as MPI_File_get_info() + * Returns: - new info object + */ + +int mca_fs_gpfs_file_get_info(ompio_file_t *fh, + ompi_info_t **info_used) +{ + int ret = OMPI_SUCCESS; + + *info_used = OBJ_NEW(ompi_info_t); + if (NULL == *info_used) { + return OMPI_ERR_OUT_OF_RESOURCE; + } + + ret = ompi_info_dup ((ompi_info_t *)fh->f_info, info_used); + + return ret; +} diff --git a/ompi/mca/fs/gpfs/fs_gpfs_file_open.c b/ompi/mca/fs/gpfs/fs_gpfs_file_open.c index dd54484924..be72799bb8 100644 --- a/ompi/mca/fs/gpfs/fs_gpfs_file_open.c +++ b/ompi/mca/fs/gpfs/fs_gpfs_file_open.c @@ -41,10 +41,10 @@ int mca_fs_gpfs_file_open (struct ompi_communicator_t *comm, - char* filename, + const char* filename, int access_mode, - struct ompi_info_t *info, - mca_io_ompio_file_t *fh) + struct opal_info_t *info, + ompio_file_t *fh) { int amode; int old_mask, perm; @@ -84,7 +84,7 @@ mca_fs_gpfs_file_open (struct ompi_communicator_t *comm, } fh->f_amode=access_mode; - mca_fs_gpfs_file_set_info(fh, info); + mca_fs_gpfs_file_set_info(fh, (struct ompi_info_t *) info); return OMPI_SUCCESS; } @@ -93,9 +93,9 @@ int mca_fs_gpfs_file_get_amode (ompi_file_t *fh, int *amode) { - mca_io_ompio_data_t *data; + mca_common_ompio_data_t *data; - data = (mca_io_ompio_data_t *) fh->f_io_selected_data; + data = (mca_common_ompio_data_t *) fh->f_io_selected_data; *amode = data->ompio_fh.f_amode; @@ -107,10 +107,10 @@ int mca_fs_gpfs_file_seek(ompi_file_t *fh, OMPI_MPI_OFFSET_TYPE off, int whence) { //DEBUG: fprintf(stderr, "GPFS FILE SEEK!"); int ret = OMPI_SUCCESS; - mca_io_ompio_data_t *data; + mca_common_ompio_data_t *data; OMPI_MPI_OFFSET_TYPE offset, temp_offset; - data = (mca_io_ompio_data_t *) fh->f_io_selected_data; + data = (mca_common_ompio_data_t *) fh->f_io_selected_data; offset = off * data->ompio_fh.f_etype_size; @@ -139,15 +139,15 @@ mca_fs_gpfs_file_seek(ompi_file_t *fh, OMPI_MPI_OFFSET_TYPE off, int whence) { return OMPI_ERROR; } - ret = ompi_io_ompio_set_explicit_offset(&data->ompio_fh, offset + ret = mca_common_ompio_set_explicit_offset(&data->ompio_fh, offset / data->ompio_fh.f_etype_size); return ret; } int mca_fs_gpfs_file_get_position(ompi_file_t *fh, OMPI_MPI_OFFSET_TYPE *offset) { - mca_io_ompio_data_t *data; + mca_common_ompio_data_t *data; - data = (mca_io_ompio_data_t *) fh->f_io_selected_data; + data = (mca_common_ompio_data_t *) fh->f_io_selected_data; *offset = data->ompio_fh.f_position_in_file_view / data->ompio_fh.f_etype_size; diff --git a/ompi/mca/fs/gpfs/fs_gpfs_file_set_info.c b/ompi/mca/fs/gpfs/fs_gpfs_file_set_info.c index bfcaf5889b..c40cda1a26 100644 --- a/ompi/mca/fs/gpfs/fs_gpfs_file_set_info.c +++ b/ompi/mca/fs/gpfs/fs_gpfs_file_set_info.c @@ -31,6 +31,8 @@ #include #include +#define DATASHIPPING_ENABLED 0 + /* * file_set_info_gpfs * @@ -69,6 +71,7 @@ struct { gpfsCancelHints_t gpfsCancelHints; } gpfs_hint_CancelHints; +#if DATASHIPPING_ENABLED struct { gpfsFcntlHeader_t gpfsFcntlHeader; gpfsDataShipStart_t gpfsDataShipStart; @@ -88,6 +91,7 @@ struct { gpfsFcntlHeader_t gpfsFcntlHeader; gpfsDataShipStop_t gpfsDataShipStop; } gpfs_hint_DataShipStop; +#endif struct { gpfsFcntlHeader_t gpfsFcntlHeader; @@ -167,297 +171,299 @@ struct { -int mca_fs_gpfs_file_set_info(mca_io_ompio_file_t *fh, struct ompi_info_t *info) { - //DEBUG: fprintf(stderr, "GPFS SET INFO\n"); - int rc = 0; - int flag; - int valueLen = MPI_MAX_INFO_VAL; - char value[MPI_MAX_INFO_VAL + 1]; - char gpfsHintsKey[50]; - const char* split = ","; - char* token; - int ret = OMPI_SUCCESS; - ompi_info_t *info_selected; - info_selected = info; - gpfs_file_t gpfs_file_handle = fh->fd; - - strcpy(gpfsHintsKey, "useSIOXLib"); - ompi_info_get(info_selected, gpfsHintsKey, valueLen, value, &flag); - if (flag) { - if(strcmp(value, "true") == 0) { - //using the SIOX lib and the I/O pattern selection - ret = mca_fs_gpfs_io_selection(fh, info, info_selected); - if (ret != OMPI_SUCCESS) - return ret; - } - else { - //CN: Is there something left to do here? - //TODO Sending the MPI_INFO to SIOX for knowledgebase - } - } - - //Setting GPFS Hint - gpfsAccessRange - strcpy(gpfsHintsKey, "gpfsAccessRange"); - ompi_info_get(info_selected, gpfsHintsKey, valueLen, value, &flag); - if (flag) { - printf("GPFS Access Range is set: %s: %s\n", gpfsHintsKey, value); - gpfs_hint_AccessRange.gpfsFcntlHeader.totalLength = sizeof(gpfs_hint_AccessRange); - gpfs_hint_AccessRange.gpfsFcntlHeader.fcntlVersion = GPFS_FCNTL_CURRENT_VERSION; - gpfs_hint_AccessRange.gpfsFcntlHeader.fcntlReserved = 0; - - gpfs_hint_AccessRange.gpfsAccessRange.structLen = - sizeof(gpfs_hint_AccessRange.gpfsAccessRange); - gpfs_hint_AccessRange.gpfsAccessRange.structType = GPFS_ACCESS_RANGE; - token = strtok(value, split); - gpfs_hint_AccessRange.gpfsAccessRange.start = atol(token); - token = strtok(NULL, split); - gpfs_hint_AccessRange.gpfsAccessRange.length = atol(token); - token = strtok(NULL, split); - gpfs_hint_AccessRange.gpfsAccessRange.isWrite = atoi(token); - - rc = gpfs_fcntl(gpfs_file_handle, &gpfs_hint_AccessRange); - if (rc != 0) { - rc = errno; - printf( - "gpfs_hint_AccessRange gpfs_fcntl(file handle: %d): Error number is %d, %s\n", - gpfs_file_handle, rc, strerror(rc)); - ret = OMPI_ERROR; - } - } - - //Setting GPFS Hint - gpfsFreeRange - strcpy(gpfsHintsKey, "gpfsFreeRange"); - ompi_info_get(info_selected, gpfsHintsKey, valueLen, value, &flag); - if (flag) { - printf("GPFS Free Range is set: %s: %s\n", gpfsHintsKey, value); - gpfs_hint_FreeRange.gpfsFcntlHeader.totalLength = sizeof(gpfs_hint_FreeRange); - gpfs_hint_FreeRange.gpfsFcntlHeader.fcntlVersion = GPFS_FCNTL_CURRENT_VERSION; - gpfs_hint_FreeRange.gpfsFcntlHeader.fcntlReserved = 0; - - gpfs_hint_FreeRange.gpfsFreeRange.structLen = - sizeof(gpfs_hint_FreeRange.gpfsFreeRange); - gpfs_hint_FreeRange.gpfsFreeRange.structType = GPFS_FREE_RANGE; - token = strtok(value, split); - gpfs_hint_FreeRange.gpfsFreeRange.start = atol(token); - token = strtok(NULL, split); - gpfs_hint_FreeRange.gpfsFreeRange.length = atol(token); - - rc = gpfs_fcntl(gpfs_file_handle, &gpfs_hint_FreeRange); - if (rc != 0) { - rc = errno; - printf( - "gpfs_hint_FreeRange gpfs_fcntl(file handle: %d): Error number is %d, %s\n", - gpfs_file_handle, rc, strerror(rc)); - ret = OMPI_ERROR; - } - } - - //CN: TODO - //Setting GPFS Hint - gpfsRangeArray - //Setting GPFS Hint - gpfsMultipleAccessRange - - //Setting GPFS Hint - gpfsClearFileCache - strcpy(gpfsHintsKey, "gpfsClearFileCache"); - ompi_info_get(info_selected, gpfsHintsKey, valueLen, value, &flag); - if (flag & strcmp(value, "true") == 0) { - printf("GPFS Clear File Cache is set: %s: %s\n", gpfsHintsKey, value); - gpfs_hint_ClearFileCache.gpfsFcntlHeader.totalLength = sizeof(gpfs_hint_ClearFileCache); - gpfs_hint_ClearFileCache.gpfsFcntlHeader.fcntlVersion = GPFS_FCNTL_CURRENT_VERSION; - gpfs_hint_ClearFileCache.gpfsFcntlHeader.fcntlReserved = 0; - - gpfs_hint_ClearFileCache.gpfsClearFileCache.structLen = - sizeof(gpfs_hint_ClearFileCache.gpfsClearFileCache); - gpfs_hint_ClearFileCache.gpfsClearFileCache.structType = GPFS_CLEAR_FILE_CACHE; - - rc = gpfs_fcntl(gpfs_file_handle, &gpfs_hint_ClearFileCache); - if (rc != 0) { - rc = errno; - printf( - "gpfs_hint_ClearFileCache gpfs_fcntl(file handle: %d): Error number is %d, %s\n", - gpfs_file_handle, rc, strerror(rc)); - ret = OMPI_ERROR; - } - } - - //Setting GPFS Hint - gpfsCancelHints - strcpy(gpfsHintsKey, "gpfsCancelHints"); - ompi_info_get(info_selected, gpfsHintsKey, valueLen, value, &flag); - if (flag & strcmp(value, "true") == 0) { - printf("GPFS Cancel Hints is set: %s: %s\n", gpfsHintsKey, value); - gpfs_hint_CancelHints.gpfsFcntlHeader.totalLength = sizeof(gpfs_hint_CancelHints); - gpfs_hint_CancelHints.gpfsFcntlHeader.fcntlVersion = GPFS_FCNTL_CURRENT_VERSION; - gpfs_hint_CancelHints.gpfsFcntlHeader.fcntlReserved = 0; - - gpfs_hint_CancelHints.gpfsCancelHints.structLen = - sizeof(gpfs_hint_CancelHints.gpfsCancelHints); - gpfs_hint_CancelHints.gpfsCancelHints.structType = GPFS_CANCEL_HINTS; - - rc = gpfs_fcntl(gpfs_file_handle, &gpfs_hint_CancelHints); - if (rc != 0) { - rc = errno; - printf( - "gpfs_hint_CancelHints gpfs_fcntl(file handle: %d): Error number is %d, %s\n", - gpfs_file_handle, rc, strerror(rc)); - ret = OMPI_ERROR; - } - } - - //Setting GPFS Hint - gpfsDataShipStart - strcpy(gpfsHintsKey, "gpfsDataShipStart"); - ompi_info_get(info_selected, gpfsHintsKey, valueLen, value, &flag); - if (flag) { - printf("GPFS Data Ship Start is set: %s: %s\n", gpfsHintsKey, value); - gpfs_hint_DataShipStart.gpfsFcntlHeader.totalLength = sizeof(gpfs_hint_DataShipStart); - gpfs_hint_DataShipStart.gpfsFcntlHeader.fcntlVersion = GPFS_FCNTL_CURRENT_VERSION; - gpfs_hint_DataShipStart.gpfsFcntlHeader.fcntlReserved = 0; - - gpfs_hint_DataShipStart.gpfsDataShipStart.structLen = - sizeof(gpfs_hint_DataShipStart.gpfsDataShipStart); - gpfs_hint_DataShipStart.gpfsDataShipStart.structType = GPFS_DATA_SHIP_START; - token = strtok(value, split); - gpfs_hint_DataShipStart.gpfsDataShipStart.numInstances = atoi(token); - gpfs_hint_DataShipStart.gpfsDataShipStart.reserved = 0; - - rc = gpfs_fcntl(gpfs_file_handle, &gpfs_hint_DataShipStart); - if (rc != 0) { - rc = errno; - printf( - "gpfs_hint_DataShipStart gpfs_fcntl(file handle: %d): Error number is %d, %s\n", - gpfs_file_handle, rc, strerror(rc)); - ret = OMPI_ERROR; - } - } - - //CN: TODO - //Setting GPFS Hint - gpfsDataShipMap - //Setting GPFS Hint - gpfsDataShipMapVariable - - //Setting GPFS Hint - gpfsDataShipStop - strcpy(gpfsHintsKey, "gpfsDataShipStop"); - ompi_info_get(info_selected, gpfsHintsKey, valueLen, value, &flag); - if (flag & strcmp(value, "true") == 0) { - printf("GPFS Data Ship Stop is set: %s: %s\n", gpfsHintsKey, value); - gpfs_hint_DataShipStop.gpfsFcntlHeader.totalLength = sizeof(gpfs_hint_DataShipStop); - gpfs_hint_DataShipStop.gpfsFcntlHeader.fcntlVersion = GPFS_FCNTL_CURRENT_VERSION; - gpfs_hint_DataShipStop.gpfsFcntlHeader.fcntlReserved = 0; - - gpfs_hint_DataShipStop.gpfsDataShipStop.structLen = - sizeof(gpfs_hint_DataShipStop.gpfsDataShipStop); - gpfs_hint_DataShipStop.gpfsDataShipStop.structType = GPFS_DATA_SHIP_STOP; - - rc = gpfs_fcntl(gpfs_file_handle, &gpfs_hint_DataShipStop); - if (rc != 0) { - rc = errno; - printf( - "gpfs_hint_DataShipStop gpfs_fcntl(file handle: %d): Error number is %d, %s\n", - gpfs_file_handle, rc, strerror(rc)); - ret = OMPI_ERROR; - } - } - - //Setting GPFS Hint - gpfsSetReplication - strcpy(gpfsHintsKey, "gpfsSetReplication"); - ompi_info_get(info_selected, gpfsHintsKey, valueLen, value, &flag); - if (flag) { - printf("GPFS Set Replication is set: %s: %s\n", gpfsHintsKey, value); - gpfs_hint_SetReplication.gpfsFcntlHeader.totalLength = sizeof(gpfs_hint_SetReplication); - gpfs_hint_SetReplication.gpfsFcntlHeader.fcntlVersion = GPFS_FCNTL_CURRENT_VERSION; - gpfs_hint_SetReplication.gpfsFcntlHeader.fcntlReserved = 0; - - gpfs_hint_SetReplication.gpfsSetReplication.structLen = - sizeof(gpfs_hint_SetReplication.gpfsSetReplication); - gpfs_hint_SetReplication.gpfsSetReplication.structType = GPFS_FCNTL_SET_REPLICATION; - token = strtok(value, split); - gpfs_hint_SetReplication.gpfsSetReplication.metadataReplicas = atoi(token); - gpfs_hint_SetReplication.gpfsSetReplication.maxMetadataReplicas = atoi(token); - gpfs_hint_SetReplication.gpfsSetReplication.dataReplicas = atoi(token); - gpfs_hint_SetReplication.gpfsSetReplication.maxDataReplicas = atoi(token); - gpfs_hint_SetReplication.gpfsSetReplication.reserved = 0; - - rc = gpfs_fcntl(gpfs_file_handle, &gpfs_hint_SetReplication); - if (rc != 0) { - rc = errno; - printf( - "gpfs_hint_SetReplication gpfs_fcntl(file handle: %d): Error number is %d, %s\n", - gpfs_file_handle, rc, strerror(rc)); - ret = OMPI_ERROR; - } - } - - //CN: TODO - //Setting GPFS Hint - gpfsSetStoragePool - - //Setting GPFS Hint - gpfsByteRange - strcpy(gpfsHintsKey, "gpfsByteRange"); - ompi_info_get(info_selected, gpfsHintsKey, valueLen, value, &flag); - if (flag) { - printf("GPFS Byte Range is set: %s: %s\n", gpfsHintsKey, value); - gpfs_hint_ByteRange.gpfsFcntlHeader.totalLength = sizeof(gpfs_hint_ByteRange); - gpfs_hint_ByteRange.gpfsFcntlHeader.fcntlVersion = GPFS_FCNTL_CURRENT_VERSION; - gpfs_hint_ByteRange.gpfsFcntlHeader.fcntlReserved = 0; - - token = strtok(value, split); - gpfs_hint_ByteRange.gpfsByteRange.startOffset = atol(token); - token = strtok(value, split); - gpfs_hint_ByteRange.gpfsByteRange.numOfBlks = atol(token); - - rc = gpfs_fcntl(gpfs_file_handle, &gpfs_hint_ByteRange); - if (rc != 0) { - rc = errno; - printf( - "gpfs_hint_ByteRange gpfs_fcntl(file handle: %d): Error number is %d, %s\n", - gpfs_file_handle, rc, strerror(rc)); - ret = OMPI_ERROR; - } - } - - //Setting GPFS Hint - gpfsRestripeData - strcpy(gpfsHintsKey, "gpfsRestripeData"); - ompi_info_get(info_selected, gpfsHintsKey, valueLen, value, &flag); - if (flag) { - printf("GPFS Restripe Data is set: %s: %s\n", gpfsHintsKey, value); - gpfs_hint_RestripeData.gpfsFcntlHeader.totalLength = sizeof(gpfs_hint_RestripeData); - gpfs_hint_RestripeData.gpfsFcntlHeader.fcntlVersion = GPFS_FCNTL_CURRENT_VERSION; - gpfs_hint_RestripeData.gpfsFcntlHeader.fcntlReserved = 0; - - gpfs_hint_RestripeData.gpfsRestripeData.structLen = - sizeof(gpfs_hint_RestripeData.gpfsRestripeData); - gpfs_hint_RestripeData.gpfsRestripeData.structType = GPFS_FCNTL_RESTRIPE_DATA; - token = strtok(value, split); - gpfs_hint_RestripeData.gpfsRestripeData.options = atoi(token); - gpfs_hint_RestripeData.gpfsRestripeData.reserved1 = 0; - gpfs_hint_RestripeData.gpfsRestripeData.reserved2 = 0; - - rc = gpfs_fcntl(gpfs_file_handle, &gpfs_hint_RestripeData); - if (rc != 0) { - rc = errno; - printf( - "gpfs_hint_RestripeData gpfs_fcntl(file handle: %d): Error number is %d, %s\n", - gpfs_file_handle, rc, strerror(rc)); - ret = OMPI_ERROR; - } - } - - //CN: TODO - //Setting GPFS Hint - gpfsRestripeRange - //Setting GPFS Hint - gpfsGetReplication - //Setting GPFS Hint - gpfsGetStoragePool - //Setting GPFS Hint - gpfsGetFilesetName - //Setting GPFS Hint - gpfsGetSnapshotName - //Setting GPFS Hint - gpfsSetImmutable - //Setting GPFS Hint - gpfsGetImmutable - //Setting GPFS Hint - gpfsSetExpTime - //Setting GPFS Hint - gpfsGetExpTime - //Setting GPFS Hint - gpfsSetAppendOnly - //Setting GPFS Hint - gpfsGetAppendOnly - - return ret; +int mca_fs_gpfs_file_set_info(ompio_file_t *fh, struct ompi_info_t *info) +{ + int rc = 0; + int flag; + int valueLen = MPI_MAX_INFO_VAL; + char value[MPI_MAX_INFO_VAL + 1]; + char gpfsHintsKey[50]; + const char* split = ","; + char* token; + int ret = OMPI_SUCCESS; + ompi_info_t *info_selected; + info_selected = info; + gpfs_file_t gpfs_file_handle = fh->fd; + + strcpy(gpfsHintsKey, "useSIOXLib"); + ompi_info_get(info_selected, gpfsHintsKey, valueLen, value, &flag); + if (flag) { + if(strcmp(value, "true") == 0) { + //using the SIOX lib and the I/O pattern selection + ret = mca_fs_gpfs_io_selection(fh, info, info_selected); + if (ret != OMPI_SUCCESS) + return ret; + } + else { + //CN: Is there something left to do here? + //TODO Sending the MPI_INFO to SIOX for knowledgebase + } + } + + //Setting GPFS Hint - gpfsAccessRange + strcpy(gpfsHintsKey, "gpfsAccessRange"); + ompi_info_get(info_selected, gpfsHintsKey, valueLen, value, &flag); + if (flag) { + printf("GPFS Access Range is set: %s: %s\n", gpfsHintsKey, value); + gpfs_hint_AccessRange.gpfsFcntlHeader.totalLength = sizeof(gpfs_hint_AccessRange); + gpfs_hint_AccessRange.gpfsFcntlHeader.fcntlVersion = GPFS_FCNTL_CURRENT_VERSION; + gpfs_hint_AccessRange.gpfsFcntlHeader.fcntlReserved = 0; + + gpfs_hint_AccessRange.gpfsAccessRange.structLen = + sizeof(gpfs_hint_AccessRange.gpfsAccessRange); + gpfs_hint_AccessRange.gpfsAccessRange.structType = GPFS_ACCESS_RANGE; + token = strtok(value, split); + gpfs_hint_AccessRange.gpfsAccessRange.start = atol(token); + token = strtok(NULL, split); + gpfs_hint_AccessRange.gpfsAccessRange.length = atol(token); + token = strtok(NULL, split); + gpfs_hint_AccessRange.gpfsAccessRange.isWrite = atoi(token); + + rc = gpfs_fcntl(gpfs_file_handle, &gpfs_hint_AccessRange); + if (rc != 0) { + rc = errno; + printf( + "gpfs_hint_AccessRange gpfs_fcntl(file handle: %d): Error number is %d, %s\n", + gpfs_file_handle, rc, strerror(rc)); + ret = OMPI_ERROR; + } + } + + //Setting GPFS Hint - gpfsFreeRange + strcpy(gpfsHintsKey, "gpfsFreeRange"); + ompi_info_get(info_selected, gpfsHintsKey, valueLen, value, &flag); + if (flag) { + printf("GPFS Free Range is set: %s: %s\n", gpfsHintsKey, value); + gpfs_hint_FreeRange.gpfsFcntlHeader.totalLength = sizeof(gpfs_hint_FreeRange); + gpfs_hint_FreeRange.gpfsFcntlHeader.fcntlVersion = GPFS_FCNTL_CURRENT_VERSION; + gpfs_hint_FreeRange.gpfsFcntlHeader.fcntlReserved = 0; + + gpfs_hint_FreeRange.gpfsFreeRange.structLen = + sizeof(gpfs_hint_FreeRange.gpfsFreeRange); + gpfs_hint_FreeRange.gpfsFreeRange.structType = GPFS_FREE_RANGE; + token = strtok(value, split); + gpfs_hint_FreeRange.gpfsFreeRange.start = atol(token); + token = strtok(NULL, split); + gpfs_hint_FreeRange.gpfsFreeRange.length = atol(token); + + rc = gpfs_fcntl(gpfs_file_handle, &gpfs_hint_FreeRange); + if (rc != 0) { + rc = errno; + printf( + "gpfs_hint_FreeRange gpfs_fcntl(file handle: %d): Error number is %d, %s\n", + gpfs_file_handle, rc, strerror(rc)); + ret = OMPI_ERROR; + } + } + + //CN: TODO + //Setting GPFS Hint - gpfsRangeArray + //Setting GPFS Hint - gpfsMultipleAccessRange + + //Setting GPFS Hint - gpfsClearFileCache + strcpy(gpfsHintsKey, "gpfsClearFileCache"); + ompi_info_get(info_selected, gpfsHintsKey, valueLen, value, &flag); + if (flag & (strcmp(value, "true") == 0)) { + printf("GPFS Clear File Cache is set: %s: %s\n", gpfsHintsKey, value); + gpfs_hint_ClearFileCache.gpfsFcntlHeader.totalLength = sizeof(gpfs_hint_ClearFileCache); + gpfs_hint_ClearFileCache.gpfsFcntlHeader.fcntlVersion = GPFS_FCNTL_CURRENT_VERSION; + gpfs_hint_ClearFileCache.gpfsFcntlHeader.fcntlReserved = 0; + + gpfs_hint_ClearFileCache.gpfsClearFileCache.structLen = + sizeof(gpfs_hint_ClearFileCache.gpfsClearFileCache); + gpfs_hint_ClearFileCache.gpfsClearFileCache.structType = GPFS_CLEAR_FILE_CACHE; + + rc = gpfs_fcntl(gpfs_file_handle, &gpfs_hint_ClearFileCache); + if (rc != 0) { + rc = errno; + printf( + "gpfs_hint_ClearFileCache gpfs_fcntl(file handle: %d): Error number is %d, %s\n", + gpfs_file_handle, rc, strerror(rc)); + ret = OMPI_ERROR; + } + } + + //Setting GPFS Hint - gpfsCancelHints + strcpy(gpfsHintsKey, "gpfsCancelHints"); + ompi_info_get(info_selected, gpfsHintsKey, valueLen, value, &flag); + if (flag & (strcmp(value, "true") == 0)) { + printf("GPFS Cancel Hints is set: %s: %s\n", gpfsHintsKey, value); + gpfs_hint_CancelHints.gpfsFcntlHeader.totalLength = sizeof(gpfs_hint_CancelHints); + gpfs_hint_CancelHints.gpfsFcntlHeader.fcntlVersion = GPFS_FCNTL_CURRENT_VERSION; + gpfs_hint_CancelHints.gpfsFcntlHeader.fcntlReserved = 0; + + gpfs_hint_CancelHints.gpfsCancelHints.structLen = + sizeof(gpfs_hint_CancelHints.gpfsCancelHints); + gpfs_hint_CancelHints.gpfsCancelHints.structType = GPFS_CANCEL_HINTS; + + rc = gpfs_fcntl(gpfs_file_handle, &gpfs_hint_CancelHints); + if (rc != 0) { + rc = errno; + printf( + "gpfs_hint_CancelHints gpfs_fcntl(file handle: %d): Error number is %d, %s\n", + gpfs_file_handle, rc, strerror(rc)); + ret = OMPI_ERROR; + } + } + +#if DATASHIPPING_ENABLED + //Setting GPFS Hint - gpfsDataShipStart + strcpy(gpfsHintsKey, "gpfsDataShipStart"); + ompi_info_get(info_selected, gpfsHintsKey, valueLen, value, &flag); + if (flag) { + printf("GPFS Data Ship Start is set: %s: %s\n", gpfsHintsKey, value); + gpfs_hint_DataShipStart.gpfsFcntlHeader.totalLength = sizeof(gpfs_hint_DataShipStart); + gpfs_hint_DataShipStart.gpfsFcntlHeader.fcntlVersion = GPFS_FCNTL_CURRENT_VERSION; + gpfs_hint_DataShipStart.gpfsFcntlHeader.fcntlReserved = 0; + + gpfs_hint_DataShipStart.gpfsDataShipStart.structLen = + sizeof(gpfs_hint_DataShipStart.gpfsDataShipStart); + gpfs_hint_DataShipStart.gpfsDataShipStart.structType = GPFS_DATA_SHIP_START; + token = strtok(value, split); + gpfs_hint_DataShipStart.gpfsDataShipStart.numInstances = atoi(token); + gpfs_hint_DataShipStart.gpfsDataShipStart.reserved = 0; + + rc = gpfs_fcntl(gpfs_file_handle, &gpfs_hint_DataShipStart); + if (rc != 0) { + rc = errno; + printf( + "gpfs_hint_DataShipStart gpfs_fcntl(file handle: %d): Error number is %d, %s\n", + gpfs_file_handle, rc, strerror(rc)); + ret = OMPI_ERROR; + } + } + + //CN: TODO + //Setting GPFS Hint - gpfsDataShipMap + //Setting GPFS Hint - gpfsDataShipMapVariable + + //Setting GPFS Hint - gpfsDataShipStop + strcpy(gpfsHintsKey, "gpfsDataShipStop"); + ompi_info_get(info_selected, gpfsHintsKey, valueLen, value, &flag); + if (flag & strcmp(value, "true") == 0) { + printf("GPFS Data Ship Stop is set: %s: %s\n", gpfsHintsKey, value); + gpfs_hint_DataShipStop.gpfsFcntlHeader.totalLength = sizeof(gpfs_hint_DataShipStop); + gpfs_hint_DataShipStop.gpfsFcntlHeader.fcntlVersion = GPFS_FCNTL_CURRENT_VERSION; + gpfs_hint_DataShipStop.gpfsFcntlHeader.fcntlReserved = 0; + + gpfs_hint_DataShipStop.gpfsDataShipStop.structLen = + sizeof(gpfs_hint_DataShipStop.gpfsDataShipStop); + gpfs_hint_DataShipStop.gpfsDataShipStop.structType = GPFS_DATA_SHIP_STOP; + + rc = gpfs_fcntl(gpfs_file_handle, &gpfs_hint_DataShipStop); + if (rc != 0) { + rc = errno; + printf( + "gpfs_hint_DataShipStop gpfs_fcntl(file handle: %d): Error number is %d, %s\n", + gpfs_file_handle, rc, strerror(rc)); + ret = OMPI_ERROR; + } + } +#endif + + //Setting GPFS Hint - gpfsSetReplication + strcpy(gpfsHintsKey, "gpfsSetReplication"); + ompi_info_get(info_selected, gpfsHintsKey, valueLen, value, &flag); + if (flag) { + printf("GPFS Set Replication is set: %s: %s\n", gpfsHintsKey, value); + gpfs_hint_SetReplication.gpfsFcntlHeader.totalLength = sizeof(gpfs_hint_SetReplication); + gpfs_hint_SetReplication.gpfsFcntlHeader.fcntlVersion = GPFS_FCNTL_CURRENT_VERSION; + gpfs_hint_SetReplication.gpfsFcntlHeader.fcntlReserved = 0; + + gpfs_hint_SetReplication.gpfsSetReplication.structLen = + sizeof(gpfs_hint_SetReplication.gpfsSetReplication); + gpfs_hint_SetReplication.gpfsSetReplication.structType = GPFS_FCNTL_SET_REPLICATION; + token = strtok(value, split); + gpfs_hint_SetReplication.gpfsSetReplication.metadataReplicas = atoi(token); + gpfs_hint_SetReplication.gpfsSetReplication.maxMetadataReplicas = atoi(token); + gpfs_hint_SetReplication.gpfsSetReplication.dataReplicas = atoi(token); + gpfs_hint_SetReplication.gpfsSetReplication.maxDataReplicas = atoi(token); + gpfs_hint_SetReplication.gpfsSetReplication.reserved = 0; + + rc = gpfs_fcntl(gpfs_file_handle, &gpfs_hint_SetReplication); + if (rc != 0) { + rc = errno; + printf( + "gpfs_hint_SetReplication gpfs_fcntl(file handle: %d): Error number is %d, %s\n", + gpfs_file_handle, rc, strerror(rc)); + ret = OMPI_ERROR; + } + } + + //CN: TODO + //Setting GPFS Hint - gpfsSetStoragePool + + //Setting GPFS Hint - gpfsByteRange + strcpy(gpfsHintsKey, "gpfsByteRange"); + ompi_info_get(info_selected, gpfsHintsKey, valueLen, value, &flag); + if (flag) { + printf("GPFS Byte Range is set: %s: %s\n", gpfsHintsKey, value); + gpfs_hint_ByteRange.gpfsFcntlHeader.totalLength = sizeof(gpfs_hint_ByteRange); + gpfs_hint_ByteRange.gpfsFcntlHeader.fcntlVersion = GPFS_FCNTL_CURRENT_VERSION; + gpfs_hint_ByteRange.gpfsFcntlHeader.fcntlReserved = 0; + + token = strtok(value, split); + gpfs_hint_ByteRange.gpfsByteRange.startOffset = atol(token); + token = strtok(value, split); + gpfs_hint_ByteRange.gpfsByteRange.numOfBlks = atol(token); + + rc = gpfs_fcntl(gpfs_file_handle, &gpfs_hint_ByteRange); + if (rc != 0) { + rc = errno; + printf( + "gpfs_hint_ByteRange gpfs_fcntl(file handle: %d): Error number is %d, %s\n", + gpfs_file_handle, rc, strerror(rc)); + ret = OMPI_ERROR; + } + } + + //Setting GPFS Hint - gpfsRestripeData + strcpy(gpfsHintsKey, "gpfsRestripeData"); + ompi_info_get(info_selected, gpfsHintsKey, valueLen, value, &flag); + if (flag) { + printf("GPFS Restripe Data is set: %s: %s\n", gpfsHintsKey, value); + gpfs_hint_RestripeData.gpfsFcntlHeader.totalLength = sizeof(gpfs_hint_RestripeData); + gpfs_hint_RestripeData.gpfsFcntlHeader.fcntlVersion = GPFS_FCNTL_CURRENT_VERSION; + gpfs_hint_RestripeData.gpfsFcntlHeader.fcntlReserved = 0; + + gpfs_hint_RestripeData.gpfsRestripeData.structLen = + sizeof(gpfs_hint_RestripeData.gpfsRestripeData); + gpfs_hint_RestripeData.gpfsRestripeData.structType = GPFS_FCNTL_RESTRIPE_DATA; + token = strtok(value, split); + gpfs_hint_RestripeData.gpfsRestripeData.options = atoi(token); + gpfs_hint_RestripeData.gpfsRestripeData.reserved1 = 0; + gpfs_hint_RestripeData.gpfsRestripeData.reserved2 = 0; + + rc = gpfs_fcntl(gpfs_file_handle, &gpfs_hint_RestripeData); + if (rc != 0) { + rc = errno; + printf( + "gpfs_hint_RestripeData gpfs_fcntl(file handle: %d): Error number is %d, %s\n", + gpfs_file_handle, rc, strerror(rc)); + ret = OMPI_ERROR; + } + } + + //CN: TODO + //Setting GPFS Hint - gpfsRestripeRange + //Setting GPFS Hint - gpfsGetReplication + //Setting GPFS Hint - gpfsGetStoragePool + //Setting GPFS Hint - gpfsGetFilesetName + //Setting GPFS Hint - gpfsGetSnapshotName + //Setting GPFS Hint - gpfsSetImmutable + //Setting GPFS Hint - gpfsGetImmutable + //Setting GPFS Hint - gpfsSetExpTime + //Setting GPFS Hint - gpfsGetExpTime + //Setting GPFS Hint - gpfsSetAppendOnly + //Setting GPFS Hint - gpfsGetAppendOnly + + return ret; } //CN: Will this function set info keys with siox prefix? //CN: Where shall the knowledge of the optimization of GPFS hints go? Into Open MPI or into SIOX? //CN: Never ever exit! Open MPI requires error propagation. -int mca_fs_gpfs_io_selection(mca_io_ompio_file_t *fh, +int mca_fs_gpfs_io_selection(ompio_file_t *fh, struct ompi_info_t *info, struct ompi_info_t *info_selected) { //CN: configure option to enable/disable SIOX support?