cleanup the usage of printf vs. opal_output
This commit is contained in:
parent
e57861b0a5
commit
5ef0632f9d
@ -9,7 +9,7 @@
|
||||
* University of Stuttgart. All rights reserved.
|
||||
* Copyright (c) 2004-2005 The Regents of the University of California.
|
||||
* All rights reserved.
|
||||
* Copyright (c) 2013 University of Houston. All rights reserved.
|
||||
* Copyright (c) 2013-2015 University of Houston. All rights reserved.
|
||||
* $COPYRIGHT$
|
||||
*
|
||||
* Additional copyrights may follow
|
||||
@ -26,6 +26,7 @@
|
||||
#include "ompi_config.h"
|
||||
#include "mpi.h"
|
||||
#include "ompi/mca/sharedfp/sharedfp.h"
|
||||
#include "ompi/mca/sharedfp/base/base.h"
|
||||
#include "ompi/mca/sharedfp/individual/sharedfp_individual.h"
|
||||
|
||||
/*
|
||||
@ -84,14 +85,16 @@ struct mca_sharedfp_base_module_1_0_0_t * mca_sharedfp_individual_component_file
|
||||
if ( amode & MPI_MODE_WRONLY || amode & MPI_MODE_RDWR ) {
|
||||
wronly_flag=true;
|
||||
if ( mca_sharedfp_individual_verbose ) {
|
||||
printf("mca_sharedfp_individual_component_file_query: "
|
||||
"MPI_MODE_WRONLY[true=%d,false=%d]=%d\n",true,false,wronly_flag);
|
||||
opal_output(ompi_sharedfp_base_framework.framework_output,
|
||||
"mca_sharedfp_individual_component_file_query: "
|
||||
"MPI_MODE_WRONLY[true=%d,false=%d]=%d\n",true,false,wronly_flag);
|
||||
}
|
||||
} else {
|
||||
wronly_flag=false;
|
||||
if ( mca_sharedfp_individual_verbose ) {
|
||||
printf("mca_sharedfp_individual_component_file_query: Can not run!, "
|
||||
"MPI_MODE_WRONLY[true=%d,false=%d]=%d\n",true,false,wronly_flag);
|
||||
opal_output(ompi_sharedfp_base_framework.framework_output,
|
||||
"mca_sharedfp_individual_component_file_query: Can not run!, "
|
||||
"MPI_MODE_WRONLY[true=%d,false=%d]=%d\n",true,false,wronly_flag);
|
||||
}
|
||||
}
|
||||
|
||||
@ -102,27 +105,30 @@ struct mca_sharedfp_base_module_1_0_0_t * mca_sharedfp_individual_component_file
|
||||
valuelen = MPI_MAX_INFO_VAL;
|
||||
ompi_info_get ( info,"OMPIO_SHAREDFP_RELAXED_ORDERING", valuelen, value, &flag);
|
||||
if ( flag ) {
|
||||
if ( mca_sharedfp_individual_verbose ) {
|
||||
printf("mca_sharedfp_individual_component_file_query: "
|
||||
"OMPIO_SHAREDFP_RELAXED_ORDERING=%s\n",value);
|
||||
if ( mca_sharedfp_individual_verbose ) {
|
||||
opal_output(ompi_sharedfp_base_framework.framework_output,
|
||||
"mca_sharedfp_individual_component_file_query: "
|
||||
"OMPIO_SHAREDFP_RELAXED_ORDERING=%s\n",value);
|
||||
}
|
||||
/* flag - Returns true if key defined, false if not (boolean). */
|
||||
relaxed_order_flag=true;
|
||||
}
|
||||
else {
|
||||
if ( mca_sharedfp_individual_verbose ) {
|
||||
printf("mca_sharedfp_individual_component_file_query: "
|
||||
"OMPIO_SHAREDFP_RELAXED_ORDERING MPI_Info key not set. "
|
||||
"Set this key in order to increase this component's priority value.\n");
|
||||
else {
|
||||
if ( mca_sharedfp_individual_verbose ) {
|
||||
opal_output(ompi_sharedfp_base_framework.framework_output,
|
||||
"mca_sharedfp_individual_component_file_query: "
|
||||
"OMPIO_SHAREDFP_RELAXED_ORDERING MPI_Info key not set. "
|
||||
"Set this key in order to increase this component's priority value.\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
if ( mca_sharedfp_individual_verbose ) {
|
||||
printf("mca_sharedfp_individual_component_file_query: "
|
||||
"OMPIO_SHAREDFP_RELAXED_ORDERING MPI_Info key not set, "
|
||||
"got MPI_INFO_NULL. Set this key in order to increase "
|
||||
"this component's priority value.\n");
|
||||
opal_output(ompi_sharedfp_base_framework.framework_output,
|
||||
"mca_sharedfp_individual_component_file_query: "
|
||||
"OMPIO_SHAREDFP_RELAXED_ORDERING MPI_Info key not set, "
|
||||
"got MPI_INFO_NULL. Set this key in order to increase "
|
||||
"this component's priority value.\n");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -9,7 +9,7 @@
|
||||
* University of Stuttgart. All rights reserved.
|
||||
* Copyright (c) 2004-2005 The Regents of the University of California.
|
||||
* All rights reserved.
|
||||
* Copyright (c) 2013 University of Houston. All rights reserved.
|
||||
* Copyright (c) 2013-2015 University of Houston. All rights reserved.
|
||||
* $COPYRIGHT$
|
||||
*
|
||||
* Additional copyrights may follow
|
||||
@ -24,6 +24,7 @@
|
||||
#include "mpi.h"
|
||||
#include "ompi/constants.h"
|
||||
#include "ompi/mca/sharedfp/sharedfp.h"
|
||||
#include "ompi/mca/sharedfp/base/base.h"
|
||||
#include "ompi/mca/io/ompio/io_ompio.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
@ -55,8 +56,8 @@ int mca_sharedfp_individual_collaborate_data(struct mca_sharedfp_base_data_t *sh
|
||||
|
||||
headnode = (mca_sharedfp_individual_header_record*)sh->selected_module_data;
|
||||
if ( NULL == headnode) {
|
||||
opal_output(0, "sharedfp_individual_collaborate_data: headnode is NULL but file is open\n");
|
||||
return OMPI_ERROR;
|
||||
opal_output(0, "sharedfp_individual_collaborate_data: headnode is NULL but file is open\n");
|
||||
return OMPI_ERROR;
|
||||
}
|
||||
|
||||
/* Number of nodes on each process is the sum of records
|
||||
@ -65,7 +66,8 @@ int mca_sharedfp_individual_collaborate_data(struct mca_sharedfp_base_data_t *sh
|
||||
nodesoneachprocess = headnode->numofrecordsonfile + headnode->numofrecords;
|
||||
|
||||
if ( mca_sharedfp_individual_verbose ) {
|
||||
printf("Nodes of each process = %d\n",nodesoneachprocess);
|
||||
opal_output(ompi_sharedfp_base_framework.framework_output,
|
||||
"Nodes of each process = %d\n",nodesoneachprocess);
|
||||
}
|
||||
|
||||
countbuff = (int*)malloc(size * sizeof(int));
|
||||
@ -93,7 +95,7 @@ int mca_sharedfp_individual_collaborate_data(struct mca_sharedfp_base_data_t *sh
|
||||
|
||||
if ( mca_sharedfp_individual_verbose) {
|
||||
for (i = 0; i < size ; i++) {
|
||||
printf("sharedfp_individual_collaborate_data: Countbuff[%d] = %d\n", i, countbuff[i]);
|
||||
opal_output(ompi_sharedfp_base_framework.framework_output,"sharedfp_individual_collaborate_data: Countbuff[%d] = %d\n", i, countbuff[i]);
|
||||
}
|
||||
}
|
||||
|
||||
@ -106,8 +108,9 @@ int mca_sharedfp_individual_collaborate_data(struct mca_sharedfp_base_data_t *sh
|
||||
for(i = 0; i < size; i++) {
|
||||
displ[i] = totalnodes;
|
||||
if ( mca_sharedfp_individual_verbose ) {
|
||||
printf("sharedfp_individual_collaborate_data: displ[%d] = %d\n",i,displ[i]);
|
||||
}
|
||||
opal_output(ompi_sharedfp_base_framework.framework_output,
|
||||
"sharedfp_individual_collaborate_data: displ[%d] = %d\n",i,displ[i]);
|
||||
}
|
||||
totalnodes = totalnodes + countbuff[i];
|
||||
}
|
||||
|
||||
@ -156,9 +159,10 @@ int mca_sharedfp_individual_collaborate_data(struct mca_sharedfp_base_data_t *sh
|
||||
idx = mca_sharedfp_individual_getoffset(ind_ts[i],timestampbuff,totalnodes);
|
||||
|
||||
if ( mca_sharedfp_individual_verbose ) {
|
||||
printf("sharedfp_individual_collaborate_data: Process %d writing %ld bytes to main file \n",
|
||||
rank,ind_recordlength[i]);
|
||||
}
|
||||
opal_output(ompi_sharedfp_base_framework.framework_output,
|
||||
"sharedfp_individual_collaborate_data: Process %d writing %ld bytes to main file \n",
|
||||
rank,ind_recordlength[i]);
|
||||
}
|
||||
|
||||
/*Write into main data file*/
|
||||
ompio_io_ompio_file_write_at( sh->sharedfh, offsetbuff[idx], buff,
|
||||
@ -212,7 +216,7 @@ int mca_sharedfp_individual_get_timestamps_and_reclengths ( double **buff, long
|
||||
currnode = headnode->next;
|
||||
|
||||
if ( mca_sharedfp_individual_verbose ) {
|
||||
printf("Num is %d\n",num);
|
||||
opal_output(ompi_sharedfp_base_framework.framework_output,"Num is %d\n",num);
|
||||
}
|
||||
|
||||
if ( 0 == num ) {
|
||||
@ -235,8 +239,9 @@ int mca_sharedfp_individual_get_timestamps_and_reclengths ( double **buff, long
|
||||
}
|
||||
|
||||
if ( mca_sharedfp_individual_verbose ) {
|
||||
printf("sharedfp_individual_get_timestamps_and_reclengths: Numofrecords on file %d\n",
|
||||
headnode->numofrecordsonfile);
|
||||
opal_output(ompi_sharedfp_base_framework.framework_output,
|
||||
"sharedfp_individual_get_timestamps_and_reclengths: Numofrecords on file %d\n",
|
||||
headnode->numofrecordsonfile);
|
||||
}
|
||||
|
||||
if (headnode->numofrecordsonfile > 0) {
|
||||
@ -252,9 +257,10 @@ int mca_sharedfp_individual_get_timestamps_and_reclengths ( double **buff, long
|
||||
|
||||
metaoffset = metaoffset + sizeof(struct mca_sharedfp_individual_record2);
|
||||
|
||||
if ( mca_sharedfp_individual_verbose ) {
|
||||
printf("sharedfp_individual_get_timestamps_and_reclengths: Ctr = %d\n",ctr);
|
||||
}
|
||||
if ( mca_sharedfp_individual_verbose ) {
|
||||
opal_output(ompi_sharedfp_base_framework.framework_output,
|
||||
"sharedfp_individual_get_timestamps_and_reclengths: Ctr = %d\n",ctr);
|
||||
}
|
||||
ctr++;
|
||||
}
|
||||
|
||||
@ -266,9 +272,9 @@ int mca_sharedfp_individual_get_timestamps_and_reclengths ( double **buff, long
|
||||
/* Add the records from the linked list */
|
||||
currnode = headnode->next;
|
||||
while (currnode) {
|
||||
if ( mca_sharedfp_individual_verbose ) {
|
||||
printf("Ctr = %d\n",ctr);
|
||||
}
|
||||
if ( mca_sharedfp_individual_verbose ) {
|
||||
opal_output(ompi_sharedfp_base_framework.framework_output,"Ctr = %d\n",ctr);
|
||||
}
|
||||
/* Some error over here..need to check this code again */
|
||||
/*while(headnode->next != NULL)*/
|
||||
|
||||
@ -279,9 +285,10 @@ int mca_sharedfp_individual_get_timestamps_and_reclengths ( double **buff, long
|
||||
ctr = ctr + 1;
|
||||
|
||||
headnode->next = currnode->next;
|
||||
if ( mca_sharedfp_individual_verbose ) {
|
||||
printf("sharedfp_individual_get_timestamps_and_reclengths: node deleted from the metadatalinked list\n");
|
||||
}
|
||||
if ( mca_sharedfp_individual_verbose ) {
|
||||
opal_output(ompi_sharedfp_base_framework.framework_output,
|
||||
"sharedfp_individual_get_timestamps_and_reclengths: node deleted from the metadatalinked list\n");
|
||||
}
|
||||
free(currnode);
|
||||
currnode = headnode->next;
|
||||
|
||||
|
@ -9,7 +9,7 @@
|
||||
* University of Stuttgart. All rights reserved.
|
||||
* Copyright (c) 2004-2005 The Regents of the University of California.
|
||||
* All rights reserved.
|
||||
* Copyright (c) 2013 University of Houston. All rights reserved.
|
||||
* Copyright (c) 2013-2015 University of Houston. All rights reserved.
|
||||
* $COPYRIGHT$
|
||||
*
|
||||
* Additional copyrights may follow
|
||||
@ -80,7 +80,8 @@ int mca_sharedfp_individual_file_open (struct ompi_communicator_t *comm,
|
||||
/* NOTE: Open the data file without shared file pointer */
|
||||
/*--------------------------------------------------------*/
|
||||
if ( mca_sharedfp_individual_verbose ) {
|
||||
printf("mca_sharedfp_individual_file_open: open data file.\n");
|
||||
opal_output(ompi_sharedfp_base_framework.framework_output,
|
||||
"mca_sharedfp_individual_file_open: open data file.\n");
|
||||
}
|
||||
|
||||
/* data filename created by appending .data.$rank to the original filename*/
|
||||
@ -105,7 +106,8 @@ int mca_sharedfp_individual_file_open (struct ompi_communicator_t *comm,
|
||||
/* NOTE: Open the meta file without shared file pointer */
|
||||
/*----------------------------------------------------------*/
|
||||
if ( mca_sharedfp_individual_verbose ) {
|
||||
printf("mca_sharedfp_individual_file_open: metadata file.\n");
|
||||
opal_output(ompi_sharedfp_base_framework.framework_output,
|
||||
"mca_sharedfp_individual_file_open: metadata file.\n");
|
||||
}
|
||||
|
||||
/* metadata filename created by appending .metadata.$rank to the original filename*/
|
||||
@ -161,7 +163,8 @@ int mca_sharedfp_individual_file_close (mca_io_ompio_file_t *fh)
|
||||
|
||||
if ( NULL == fh->f_sharedfp_data ){
|
||||
if ( mca_sharedfp_individual_verbose ) {
|
||||
printf("sharedfp_inidividual_file_close - shared file pointer structure not initialized\n");
|
||||
opal_output(ompi_sharedfp_base_framework.framework_output,
|
||||
"sharedfp_inidividual_file_close - shared file pointer structure not initialized\n");
|
||||
}
|
||||
return OMPI_SUCCESS;
|
||||
}
|
||||
|
@ -9,7 +9,7 @@
|
||||
* University of Stuttgart. All rights reserved.
|
||||
* Copyright (c) 2004-2005 The Regents of the University of California.
|
||||
* All rights reserved.
|
||||
* Copyright (c) 2013 University of Houston. All rights reserved.
|
||||
* Copyright (c) 2013-2015 University of Houston. All rights reserved.
|
||||
* $COPYRIGHT$
|
||||
*
|
||||
* Additional copyrights may follow
|
||||
@ -24,6 +24,7 @@
|
||||
#include "mpi.h"
|
||||
#include "ompi/constants.h"
|
||||
#include "ompi/mca/sharedfp/sharedfp.h"
|
||||
#include "ompi/mca/sharedfp/base/base.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
@ -44,8 +45,9 @@ int mca_sharedfp_individual_insert_metadata(int functype,long recordlength,struc
|
||||
|
||||
|
||||
if ( mca_sharedfp_individual_verbose ) {
|
||||
printf("sharedfp_individual_insert_metadata: Headnode->numofrecords = %d\n",
|
||||
headnode->numofrecords);
|
||||
opal_output(ompi_sharedfp_base_framework.framework_output,
|
||||
"sharedfp_individual_insert_metadata: Headnode->numofrecords = %d\n",
|
||||
headnode->numofrecords);
|
||||
}
|
||||
/* Check if the maximum limit is reached for the records in the linked list*/
|
||||
if (headnode->numofrecords == MAX_METADATA_RECORDS) {
|
||||
@ -113,12 +115,17 @@ int mca_sharedfp_individual_write_metadata_file(struct mca_sharedfp_base_data_t
|
||||
buff.recordlength = current->recordlength;
|
||||
|
||||
if ( mca_sharedfp_individual_verbose ) {
|
||||
printf("sharedfp_individual_write_metadata_file: Buff recordid %ld\n",buff.recordid);
|
||||
printf("sharedfp_individual_write_metadata_file: Buff timestamp %f\n", buff.timestamp);
|
||||
printf("sharedfp_individual_write_metadata_file: Buff localposition %lld\n",buff.localposition);
|
||||
printf("sharedfp_individual_write_metadata_file: Buff recordlength %ld\n",buff.recordlength);
|
||||
printf("sharedfp_individual_write_metadata_file: Size of buff %ld\n",sizeof(buff));
|
||||
}
|
||||
opal_output(ompi_sharedfp_base_framework.framework_output,
|
||||
"sharedfp_individual_write_metadata_file: Buff recordid %ld\n",buff.recordid);
|
||||
opal_output(ompi_sharedfp_base_framework.framework_output,
|
||||
"sharedfp_individual_write_metadata_file: Buff timestamp %f\n", buff.timestamp);
|
||||
opal_output(ompi_sharedfp_base_framework.framework_output,
|
||||
"sharedfp_individual_write_metadata_file: Buff localposition %lld\n",buff.localposition);
|
||||
opal_output(ompi_sharedfp_base_framework.framework_output,
|
||||
"sharedfp_individual_write_metadata_file: Buff recordlength %ld\n",buff.recordlength);
|
||||
opal_output(ompi_sharedfp_base_framework.framework_output,
|
||||
"sharedfp_individual_write_metadata_file: Size of buff %ld\n",sizeof(buff));
|
||||
}
|
||||
|
||||
headnode->next = current->next;
|
||||
free(current);
|
||||
|
@ -24,6 +24,7 @@
|
||||
#include "mpi.h"
|
||||
#include "ompi/constants.h"
|
||||
#include "ompi/mca/sharedfp/sharedfp.h"
|
||||
#include "ompi/mca/sharedfp/base/base.h"
|
||||
|
||||
int mca_sharedfp_individual_read ( mca_io_ompio_file_t *fh,
|
||||
void *buf, int count, MPI_Datatype datatype, MPI_Status *status)
|
||||
|
@ -24,6 +24,7 @@
|
||||
#include "mpi.h"
|
||||
#include "ompi/constants.h"
|
||||
#include "ompi/mca/sharedfp/sharedfp.h"
|
||||
#include "ompi/mca/sharedfp/base/base.h"
|
||||
|
||||
int mca_sharedfp_individual_write (mca_io_ompio_file_t *fh,
|
||||
void *buf,
|
||||
@ -40,7 +41,7 @@ int mca_sharedfp_individual_write (mca_io_ompio_file_t *fh,
|
||||
|
||||
if ( NULL == fh->f_sharedfp_data ) {
|
||||
if ( mca_sharedfp_individual_verbose ) {
|
||||
printf("sharedfp_individual_write: opening the shared file pointer file\n");
|
||||
opal_output(ompi_sharedfp_base_framework.framework_output,"sharedfp_individual_write: opening the shared file pointer file\n");
|
||||
}
|
||||
shared_fp_base_module = fh->f_sharedfp;
|
||||
|
||||
@ -104,7 +105,8 @@ int mca_sharedfp_individual_write_ordered (mca_io_ompio_file_t *fh,
|
||||
|
||||
if(fh->f_sharedfp_data==NULL){
|
||||
if ( mca_sharedfp_individual_verbose ) {
|
||||
printf("sharedfp_individual_write_ordered - opening the shared file pointer\n");
|
||||
opal_output(ompi_sharedfp_base_framework.framework_output,
|
||||
"sharedfp_individual_write_ordered - opening the shared file pointer\n");
|
||||
}
|
||||
shared_fp_base_module = fh->f_sharedfp;
|
||||
|
||||
|
@ -9,7 +9,7 @@
|
||||
* University of Stuttgart. All rights reserved.
|
||||
* Copyright (c) 2004-2005 The Regents of the University of California.
|
||||
* All rights reserved.
|
||||
* Copyright (c) 2013 University of Houston. All rights reserved.
|
||||
* Copyright (c) 2013-2015 University of Houston. All rights reserved.
|
||||
* Copyright (c) 2015 Research Organization for Information Science
|
||||
* and Technology (RIST). All rights reserved.
|
||||
* $COPYRIGHT$
|
||||
@ -74,13 +74,15 @@ int mca_sharedfp_lockedfile_file_open (struct ompi_communicator_t *comm,
|
||||
|
||||
/*Open a new file which will maintain the pointer for this file open*/
|
||||
if ( mca_sharedfp_lockedfile_verbose ) {
|
||||
printf("mca_sharedfp_lockedfile_file_open: open locked file.\n");
|
||||
opal_output(ompi_sharedfp_base_framework.framework_output,
|
||||
"mca_sharedfp_lockedfile_file_open: open locked file.\n");
|
||||
}
|
||||
|
||||
|
||||
module_data = (struct mca_sharedfp_lockedfile_data*)malloc(sizeof(struct mca_sharedfp_lockedfile_data));
|
||||
if ( NULL == module_data ) {
|
||||
printf("mca_sharedfp_lockedfile_file_open: Error, unable to malloc lockedfile_data struct\n");
|
||||
opal_output(ompi_sharedfp_base_framework.framework_output,
|
||||
"mca_sharedfp_lockedfile_file_open: Error, unable to malloc lockedfile_data struct\n");
|
||||
free (shfileHandle);
|
||||
free (sh);
|
||||
return OMPI_ERR_OUT_OF_RESOURCE;
|
||||
@ -106,7 +108,7 @@ int mca_sharedfp_lockedfile_file_open (struct ompi_communicator_t *comm,
|
||||
|
||||
handle = open ( lockedfilename, O_RDWR, 0644 );
|
||||
if ( -1 == handle ) {
|
||||
printf("[%d]mca_sharedfp_lockedfile_file_open: Error during file open\n", rank);
|
||||
opal_output(0, "[%d]mca_sharedfp_lockedfile_file_open: Error during file open\n", rank);
|
||||
free (shfileHandle);
|
||||
free (sh);
|
||||
free(module_data);
|
||||
@ -135,7 +137,7 @@ int mca_sharedfp_lockedfile_file_close (mca_io_ompio_file_t *fh)
|
||||
if ( fh->f_sharedfp_data==NULL){
|
||||
/* Can happen with lazy_open being set */
|
||||
if ( mca_sharedfp_lockedfile_verbose ) {
|
||||
printf("sharedfp_lockedfile_file_close - shared file pointer structure not initialized\n");
|
||||
opal_output(0, "sharedfp_lockedfile_file_close - shared file pointer structure not initialized\n");
|
||||
}
|
||||
return OMPI_SUCCESS;
|
||||
}
|
||||
|
@ -9,7 +9,7 @@
|
||||
* University of Stuttgart. All rights reserved.
|
||||
* Copyright (c) 2004-2005 The Regents of the University of California.
|
||||
* All rights reserved.
|
||||
* Copyright (c) 2013 University of Houston. All rights reserved.
|
||||
* Copyright (c) 2013-2015 University of Houston. All rights reserved.
|
||||
* $COPYRIGHT$
|
||||
*
|
||||
* Additional copyrights may follow
|
||||
@ -24,6 +24,7 @@
|
||||
#include "mpi.h"
|
||||
#include "ompi/constants.h"
|
||||
#include "ompi/mca/sharedfp/sharedfp.h"
|
||||
#include "ompi/mca/sharedfp/base/base.h"
|
||||
|
||||
int mca_sharedfp_lockedfile_read ( mca_io_ompio_file_t *fh,
|
||||
void *buf, int count, MPI_Datatype datatype, MPI_Status *status)
|
||||
@ -37,7 +38,8 @@ int mca_sharedfp_lockedfile_read ( mca_io_ompio_file_t *fh,
|
||||
|
||||
if ( fh->f_sharedfp_data == NULL ) {
|
||||
if ( mca_sharedfp_lockedfile_verbose ) {
|
||||
printf("sharedfp_lockedfile_read: opening the shared file pointer\n");
|
||||
opal_output(ompi_sharedfp_base_framework.framework_output,
|
||||
"sharedfp_lockedfile_read: opening the shared file pointer\n");
|
||||
}
|
||||
shared_fp_base_module = fh->f_sharedfp;
|
||||
|
||||
@ -57,7 +59,8 @@ int mca_sharedfp_lockedfile_read ( mca_io_ompio_file_t *fh,
|
||||
bytesRequested = count * numofBytes;
|
||||
|
||||
if ( mca_sharedfp_lockedfile_verbose ) {
|
||||
printf("sharedfp_lockedfile_read: Bytes Requested is %ld\n",bytesRequested);
|
||||
opal_output(ompi_sharedfp_base_framework.framework_output,
|
||||
"sharedfp_lockedfile_read: Bytes Requested is %ld\n",bytesRequested);
|
||||
}
|
||||
|
||||
/*Retrieve the shared file data struct*/
|
||||
@ -67,7 +70,8 @@ int mca_sharedfp_lockedfile_read ( mca_io_ompio_file_t *fh,
|
||||
ret = mca_sharedfp_lockedfile_request_position(sh,bytesRequested,&offset);
|
||||
if (-1 != ret ) {
|
||||
if ( mca_sharedfp_lockedfile_verbose ) {
|
||||
printf("sharedfp_lockedfile_read: Offset received is %lld\n",offset);
|
||||
opal_output(ompi_sharedfp_base_framework.framework_output,
|
||||
"sharedfp_lockedfile_read: Offset received is %lld\n",offset);
|
||||
}
|
||||
|
||||
/* Read the file */
|
||||
@ -98,7 +102,8 @@ int mca_sharedfp_lockedfile_read_ordered (mca_io_ompio_file_t *fh,
|
||||
|
||||
if ( fh->f_sharedfp_data == NULL){
|
||||
if ( mca_sharedfp_lockedfile_verbose ) {
|
||||
printf("sharedfp_lockedfile_read_ordered: opening the shared file pointer\n");
|
||||
opal_output(ompi_sharedfp_base_framework.framework_output,
|
||||
"sharedfp_lockedfile_read_ordered: opening the shared file pointer\n");
|
||||
}
|
||||
shared_fp_base_module = fh->f_sharedfp;
|
||||
|
||||
@ -144,7 +149,8 @@ int mca_sharedfp_lockedfile_read_ordered (mca_io_ompio_file_t *fh,
|
||||
for (i = 0; i < size ; i ++) {
|
||||
bytesRequested += buff[i];
|
||||
if ( mca_sharedfp_lockedfile_verbose ) {
|
||||
printf("sharedfp_lockedfile_read_ordered: Bytes requested are %ld\n",bytesRequested);
|
||||
opal_output(ompi_sharedfp_base_framework.framework_output,
|
||||
"sharedfp_lockedfile_read_ordered: Bytes requested are %ld\n",bytesRequested);
|
||||
}
|
||||
}
|
||||
|
||||
@ -159,7 +165,8 @@ int mca_sharedfp_lockedfile_read_ordered (mca_io_ompio_file_t *fh,
|
||||
goto exit;
|
||||
}
|
||||
if ( mca_sharedfp_lockedfile_verbose ) {
|
||||
printf("sharedfp_lockedfile_read_ordered: Offset received is %lld\n",offsetReceived);
|
||||
opal_output(ompi_sharedfp_base_framework.framework_output,
|
||||
"sharedfp_lockedfile_read_ordered: Offset received is %lld\n",offsetReceived);
|
||||
}
|
||||
buff[0] += offsetReceived;
|
||||
|
||||
@ -177,7 +184,8 @@ int mca_sharedfp_lockedfile_read_ordered (mca_io_ompio_file_t *fh,
|
||||
offset = offsetBuff - sendBuff;
|
||||
|
||||
if ( mca_sharedfp_lockedfile_verbose ) {
|
||||
printf("sharedfp_lockedfile_read_ordered: Offset returned is %lld\n",offset);
|
||||
opal_output(ompi_sharedfp_base_framework.framework_output,
|
||||
"sharedfp_lockedfile_read_ordered: Offset returned is %lld\n",offset);
|
||||
}
|
||||
|
||||
/* read to the file */
|
||||
|
@ -9,7 +9,7 @@
|
||||
* University of Stuttgart. All rights reserved.
|
||||
* Copyright (c) 2004-2005 The Regents of the University of California.
|
||||
* All rights reserved.
|
||||
* Copyright (c) 2013 University of Houston. All rights reserved.
|
||||
* Copyright (c) 2013-2015 University of Houston. All rights reserved.
|
||||
* $COPYRIGHT$
|
||||
*
|
||||
* Additional copyrights may follow
|
||||
@ -24,6 +24,7 @@
|
||||
#include "mpi.h"
|
||||
#include "ompi/constants.h"
|
||||
#include "ompi/mca/sharedfp/sharedfp.h"
|
||||
#include "ompi/mca/sharedfp/base/base.h"
|
||||
|
||||
/*Use fcntl to lock the hidden file which stores the current position*/
|
||||
#include <fcntl.h>
|
||||
@ -62,13 +63,14 @@ int mca_sharedfp_lockedfile_request_position(struct mca_sharedfp_base_data_t * s
|
||||
|
||||
/* Aquire an exclusive lock */
|
||||
if (fcntl(fd, F_SETLKW, &fl) == -1) {
|
||||
printf("sharedfp_lockedfile_request_position: errorr acquiring lock: fcntl(%d,F_SETLKW,&fl)\n",fd);
|
||||
printf("sharedfp_lockedfile_request_position: error(%i): %s", errno, strerror(errno));
|
||||
opal_output(0,"sharedfp_lockedfile_request_position: errorr acquiring lock: fcntl(%d,F_SETLKW,&fl)\n",fd);
|
||||
opal_output(0,"sharedfp_lockedfile_request_position: error(%i): %s", errno, strerror(errno));
|
||||
return OMPI_ERROR;
|
||||
}
|
||||
else{
|
||||
if ( mca_sharedfp_lockedfile_verbose ) {
|
||||
printf("sharedfp_lockedfile_request_position: Success: acquired lock.for fd: %d\n",fd);
|
||||
opal_output(ompi_sharedfp_base_framework.framework_output,
|
||||
"sharedfp_lockedfile_request_position: Success: acquired lock.for fd: %d\n",fd);
|
||||
}
|
||||
}
|
||||
|
||||
@ -76,14 +78,16 @@ int mca_sharedfp_lockedfile_request_position(struct mca_sharedfp_base_data_t * s
|
||||
lseek ( fd, 0, SEEK_SET );
|
||||
read ( fd, &buf, sizeof(OMPI_MPI_OFFSET_TYPE));
|
||||
if ( mca_sharedfp_lockedfile_verbose ) {
|
||||
printf("sharedfp_lockedfile_request_position: Read last_offset=%lld! ret=%d\n",buf, ret);
|
||||
opal_output(ompi_sharedfp_base_framework.framework_output,
|
||||
"sharedfp_lockedfile_request_position: Read last_offset=%lld! ret=%d\n",buf, ret);
|
||||
}
|
||||
|
||||
/* increment the position */
|
||||
position = buf + bytes_requested;
|
||||
if ( mca_sharedfp_lockedfile_verbose ) {
|
||||
printf("sharedfp_lockedfile_request_position: old_offset=%lld, bytes_requested=%d, new offset=%lld!\n",
|
||||
buf,bytes_requested,position);
|
||||
opal_output(ompi_sharedfp_base_framework.framework_output,
|
||||
"sharedfp_lockedfile_request_position: old_offset=%lld, bytes_requested=%d, new offset=%lld!\n",
|
||||
buf,bytes_requested,position);
|
||||
}
|
||||
|
||||
/* write to the file */
|
||||
@ -92,7 +96,8 @@ int mca_sharedfp_lockedfile_request_position(struct mca_sharedfp_base_data_t * s
|
||||
|
||||
/* unlock the file */
|
||||
if ( mca_sharedfp_lockedfile_verbose ) {
|
||||
printf("sharedfp_lockedfile_request_position: Releasing lock...");
|
||||
opal_output(ompi_sharedfp_base_framework.framework_output,
|
||||
"sharedfp_lockedfile_request_position: Releasing lock...");
|
||||
}
|
||||
|
||||
/* NOTE: We thought we could reuse the flock struct
|
||||
@ -108,13 +113,14 @@ int mca_sharedfp_lockedfile_request_position(struct mca_sharedfp_base_data_t * s
|
||||
fl.l_pid = getpid();
|
||||
|
||||
if (fcntl(fd, F_SETLK, &fl) == -1) {
|
||||
printf("sharedfp_lockedfile_request_position:failed to release lock for fd: %d\n",fd);
|
||||
printf("error(%i): %s", errno, strerror(errno));
|
||||
opal_output(0,"sharedfp_lockedfile_request_position:failed to release lock for fd: %d\n",fd);
|
||||
opal_output(0,"error(%i): %s", errno, strerror(errno));
|
||||
return OMPI_ERROR;
|
||||
}
|
||||
else {
|
||||
if ( mca_sharedfp_lockedfile_verbose ) {
|
||||
printf("sharedfp_lockedfile_request_position: released lock.for fd: %d\n",fd);
|
||||
opal_output(ompi_sharedfp_base_framework.framework_output,
|
||||
"sharedfp_lockedfile_request_position: released lock.for fd: %d\n",fd);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -140,7 +140,8 @@ mca_sharedfp_lockedfile_seek (mca_io_ompio_file_t *fh,
|
||||
*--------------------
|
||||
*/
|
||||
if ( mca_sharedfp_lockedfile_verbose ) {
|
||||
printf("sharedfp_lockedfile_seek: Releasing lock...");
|
||||
opal_output(ompi_sharedfp_base_framework.framework_output,
|
||||
"sharedfp_lockedfile_seek: Releasing lock...");
|
||||
}
|
||||
fl.l_type = F_UNLCK; /* set to unlock same region */
|
||||
fl.l_whence = SEEK_SET;
|
||||
|
@ -9,7 +9,7 @@
|
||||
* University of Stuttgart. All rights reserved.
|
||||
* Copyright (c) 2004-2005 The Regents of the University of California.
|
||||
* All rights reserved.
|
||||
* Copyright (c) 2013 University of Houston. All rights reserved.
|
||||
* Copyright (c) 2013-2015 University of Houston. All rights reserved.
|
||||
* $COPYRIGHT$
|
||||
*
|
||||
* Additional copyrights may follow
|
||||
@ -24,6 +24,7 @@
|
||||
#include "mpi.h"
|
||||
#include "ompi/constants.h"
|
||||
#include "ompi/mca/sharedfp/sharedfp.h"
|
||||
#include "ompi/mca/sharedfp/base/base.h"
|
||||
|
||||
int mca_sharedfp_lockedfile_write (mca_io_ompio_file_t *fh,
|
||||
void *buf,
|
||||
@ -40,7 +41,8 @@ int mca_sharedfp_lockedfile_write (mca_io_ompio_file_t *fh,
|
||||
|
||||
if ( NULL == fh->f_sharedfp_data ){
|
||||
if ( mca_sharedfp_lockedfile_verbose ) {
|
||||
printf("sharedfp_lockedfile_write - opening the shared file pointer\n");
|
||||
opal_output(ompi_sharedfp_base_framework.framework_output,
|
||||
"sharedfp_lockedfile_write - opening the shared file pointer\n");
|
||||
}
|
||||
shared_fp_base_module = fh->f_sharedfp;
|
||||
|
||||
@ -59,7 +61,8 @@ int mca_sharedfp_lockedfile_write (mca_io_ompio_file_t *fh,
|
||||
opal_datatype_type_size( &datatype->super, &numofBytes);
|
||||
bytesRequested = count * numofBytes;
|
||||
if ( mca_sharedfp_lockedfile_verbose ) {
|
||||
printf("sharedfp_lockedfile_write: Bytes Requested is %ld\n",bytesRequested);
|
||||
opal_output(ompi_sharedfp_base_framework.framework_output,
|
||||
"sharedfp_lockedfile_write: Bytes Requested is %ld\n",bytesRequested);
|
||||
}
|
||||
|
||||
/*Retrieve the shared file data struct*/
|
||||
@ -69,7 +72,8 @@ int mca_sharedfp_lockedfile_write (mca_io_ompio_file_t *fh,
|
||||
ret = mca_sharedfp_lockedfile_request_position ( sh, bytesRequested, &offset);
|
||||
if (-1 != ret ) {
|
||||
if ( mca_sharedfp_lockedfile_verbose ) {
|
||||
printf("sharedfp_lockedfile_write: Offset received is %lld\n",offset);
|
||||
opal_output(ompi_sharedfp_base_framework.framework_output,
|
||||
"sharedfp_lockedfile_write: Offset received is %lld\n",offset);
|
||||
}
|
||||
/* Write to the file */
|
||||
ret = ompio_io_ompio_file_write_at ( sh->sharedfh, offset, buf, count, datatype, status);
|
||||
@ -100,7 +104,8 @@ int mca_sharedfp_lockedfile_write_ordered (mca_io_ompio_file_t *fh,
|
||||
|
||||
if( NULL == fh->f_sharedfp_data ) {
|
||||
if ( mca_sharedfp_lockedfile_verbose ) {
|
||||
printf("sharedfp_lockedfile_write_ordered - opening the shared file pointer\n");
|
||||
opal_output(ompi_sharedfp_base_framework.framework_output,
|
||||
"sharedfp_lockedfile_write_ordered - opening the shared file pointer\n");
|
||||
}
|
||||
shared_fp_base_module = fh->f_sharedfp;
|
||||
|
||||
@ -147,7 +152,8 @@ int mca_sharedfp_lockedfile_write_ordered (mca_io_ompio_file_t *fh,
|
||||
for ( i = 0; i < size ; i ++) {
|
||||
bytesRequested += buff[i];
|
||||
if ( mca_sharedfp_lockedfile_verbose ) {
|
||||
printf("sharedfp_lockedfile_write_ordered: Bytes requested are %ld\n",bytesRequested);
|
||||
opal_output(ompi_sharedfp_base_framework.framework_output,
|
||||
"sharedfp_lockedfile_write_ordered: Bytes requested are %ld\n",bytesRequested);
|
||||
}
|
||||
}
|
||||
|
||||
@ -162,7 +168,8 @@ int mca_sharedfp_lockedfile_write_ordered (mca_io_ompio_file_t *fh,
|
||||
goto exit;
|
||||
}
|
||||
if ( mca_sharedfp_lockedfile_verbose ) {
|
||||
printf("sharedfp_lockedfile_write_ordered: Offset received is %lld\n",offsetReceived);
|
||||
opal_output(ompi_sharedfp_base_framework.framework_output,
|
||||
"sharedfp_lockedfile_write_ordered: Offset received is %lld\n",offsetReceived);
|
||||
}
|
||||
buff[0] += offsetReceived;
|
||||
for (i = 1 ; i < size; i++) {
|
||||
@ -182,7 +189,8 @@ int mca_sharedfp_lockedfile_write_ordered (mca_io_ompio_file_t *fh,
|
||||
offset = offsetBuff - sendBuff;
|
||||
|
||||
if ( mca_sharedfp_lockedfile_verbose ) {
|
||||
printf("sharedfp_lockedfile_write_ordered: Offset returned is %lld\n",offset);
|
||||
opal_output(ompi_sharedfp_base_framework.framework_output,
|
||||
"sharedfp_lockedfile_write_ordered: Offset returned is %lld\n",offset);
|
||||
}
|
||||
|
||||
/* write to the file */
|
||||
|
@ -78,7 +78,8 @@ int mca_sharedfp_sm_file_open (struct ompi_communicator_t *comm,
|
||||
|
||||
/*Memory is allocated here for the sh structure*/
|
||||
if ( mca_sharedfp_sm_verbose ) {
|
||||
printf( "mca_sharedfp_sm_file_open: malloc f_sharedfp_ptr struct\n");
|
||||
opal_output(ompi_sharedfp_base_framework.framework_output,
|
||||
"mca_sharedfp_sm_file_open: malloc f_sharedfp_ptr struct\n");
|
||||
}
|
||||
|
||||
sh = (struct mca_sharedfp_base_data_t*)malloc(sizeof(struct mca_sharedfp_base_data_t));
|
||||
@ -98,7 +99,8 @@ int mca_sharedfp_sm_file_open (struct ompi_communicator_t *comm,
|
||||
|
||||
/*Open a shared memory segment which will hold the shared file pointer*/
|
||||
if ( mca_sharedfp_sm_verbose ) {
|
||||
printf( "mca_sharedfp_sm_file_open: allocatge shared memory segment.\n");
|
||||
opal_output(ompi_sharedfp_base_framework.framework_output,
|
||||
"mca_sharedfp_sm_file_open: allocatge shared memory segment.\n");
|
||||
}
|
||||
|
||||
|
||||
@ -134,7 +136,7 @@ int mca_sharedfp_sm_file_open (struct ompi_communicator_t *comm,
|
||||
S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
|
||||
if ( sm_fd == -1){
|
||||
/*error opening file*/
|
||||
printf("mca_sharedfp_sm_file_open: Error, unable to open file for mmap: %s\n",sm_filename);
|
||||
opal_output(0,"mca_sharedfp_sm_file_open: Error, unable to open file for mmap: %s\n",sm_filename);
|
||||
free(sm_filename);
|
||||
free(sm_data);
|
||||
free(sh);
|
||||
@ -159,8 +161,8 @@ int mca_sharedfp_sm_file_open (struct ompi_communicator_t *comm,
|
||||
|
||||
if ( sm_offset_ptr==MAP_FAILED){
|
||||
err = OMPI_ERROR;
|
||||
printf("mca_sharedfp_sm_file_open: Error, unable to mmap file: %s\n",sm_filename);
|
||||
printf("%s\n", strerror(errno));
|
||||
opal_output(0, "mca_sharedfp_sm_file_open: Error, unable to mmap file: %s\n",sm_filename);
|
||||
opal_output(0, "%s\n", strerror(errno));
|
||||
free(sm_filename);
|
||||
free(sm_data);
|
||||
free(sh);
|
||||
@ -220,7 +222,8 @@ int mca_sharedfp_sm_file_close (mca_io_ompio_file_t *fh)
|
||||
|
||||
if( NULL == fh->f_sharedfp_data ){
|
||||
if ( mca_sharedfp_sm_verbose ) {
|
||||
printf("sharedfp_sm_file_close: shared file pointer structure not initialized\n");
|
||||
opal_output(ompi_sharedfp_base_framework.framework_output,
|
||||
"sharedfp_sm_file_close: shared file pointer structure not initialized\n");
|
||||
}
|
||||
return OMPI_SUCCESS;
|
||||
}
|
||||
|
@ -9,7 +9,7 @@
|
||||
* University of Stuttgart. All rights reserved.
|
||||
* Copyright (c) 2004-2005 The Regents of the University of California.
|
||||
* All rights reserved.
|
||||
* Copyright (c) 201302915 University of Houston. All rights reserved.
|
||||
* Copyright (c) 2013-2015 University of Houston. All rights reserved.
|
||||
* $COPYRIGHT$
|
||||
*
|
||||
* Additional copyrights may follow
|
||||
@ -65,7 +65,8 @@ int mca_sharedfp_sm_iread(mca_io_ompio_file_t *fh,
|
||||
sh = fh->f_sharedfp_data;
|
||||
|
||||
if ( mca_sharedfp_sm_verbose ) {
|
||||
printf("sharedfp_sm_iread: Bytes Requested is %ld\n",bytesRequested);
|
||||
opal_output(ompi_sharedfp_base_framework.framework_output,
|
||||
"sharedfp_sm_iread: Bytes Requested is %ld\n",bytesRequested);
|
||||
}
|
||||
/*Request the offset to write bytesRequested bytes*/
|
||||
ret = mca_sharedfp_sm_request_position(sh,bytesRequested,&offset);
|
||||
|
@ -9,7 +9,7 @@
|
||||
* University of Stuttgart. All rights reserved.
|
||||
* Copyright (c) 2004-2005 The Regents of the University of California.
|
||||
* All rights reserved.
|
||||
* Copyright (c) 2013 University of Houston. All rights reserved.
|
||||
* Copyright (c) 2013-2015 University of Houston. All rights reserved.
|
||||
* $COPYRIGHT$
|
||||
*
|
||||
* Additional copyrights may follow
|
||||
@ -24,6 +24,7 @@
|
||||
#include "mpi.h"
|
||||
#include "ompi/constants.h"
|
||||
#include "ompi/mca/sharedfp/sharedfp.h"
|
||||
#include "ompi/mca/sharedfp/base/base.h"
|
||||
|
||||
int mca_sharedfp_sm_read ( mca_io_ompio_file_t *fh,
|
||||
void *buf, int count, MPI_Datatype datatype, MPI_Status *status)
|
||||
@ -37,7 +38,8 @@ int mca_sharedfp_sm_read ( mca_io_ompio_file_t *fh,
|
||||
|
||||
if( NULL == fh->f_sharedfp_data){
|
||||
if ( mca_sharedfp_sm_verbose ) {
|
||||
printf("sharedfp_sm_read - opening the shared file pointer\n");
|
||||
opal_output(ompi_sharedfp_base_framework.framework_output,
|
||||
"sharedfp_sm_read - opening the shared file pointer\n");
|
||||
}
|
||||
shared_fp_base_module = fh->f_sharedfp;
|
||||
|
||||
@ -60,7 +62,8 @@ int mca_sharedfp_sm_read ( mca_io_ompio_file_t *fh,
|
||||
sh = fh->f_sharedfp_data;
|
||||
|
||||
if ( mca_sharedfp_sm_verbose ) {
|
||||
printf("sharedfp_sm_read: Bytes Requested is %ld\n",bytesRequested);
|
||||
opal_output(ompi_sharedfp_base_framework.framework_output,
|
||||
"sharedfp_sm_read: Bytes Requested is %ld\n",bytesRequested);
|
||||
}
|
||||
|
||||
/*Request the offset to write bytesRequested bytes*/
|
||||
@ -68,7 +71,8 @@ int mca_sharedfp_sm_read ( mca_io_ompio_file_t *fh,
|
||||
|
||||
if ( -1 != ret ) {
|
||||
if ( mca_sharedfp_sm_verbose ) {
|
||||
printf("sharedfp_sm_read: Offset received is %lld\n",offset);
|
||||
opal_output(ompi_sharedfp_base_framework.framework_output,
|
||||
"sharedfp_sm_read: Offset received is %lld\n",offset);
|
||||
}
|
||||
|
||||
/* Read the file */
|
||||
@ -99,7 +103,8 @@ int mca_sharedfp_sm_read_ordered (mca_io_ompio_file_t *fh,
|
||||
|
||||
if ( NULL == fh->f_sharedfp_data){
|
||||
if ( mca_sharedfp_sm_verbose ) {
|
||||
printf("sharedfp_sm_read_ordered: opening the shared file pointer\n");
|
||||
opal_output(ompi_sharedfp_base_framework.framework_output,
|
||||
"sharedfp_sm_read_ordered: opening the shared file pointer\n");
|
||||
}
|
||||
shared_fp_base_module = fh->f_sharedfp;
|
||||
|
||||
@ -145,7 +150,8 @@ int mca_sharedfp_sm_read_ordered (mca_io_ompio_file_t *fh,
|
||||
for (i = 0; i < size ; i ++) {
|
||||
bytesRequested += buff[i];
|
||||
if ( mca_sharedfp_sm_verbose ) {
|
||||
printf("mca_sharedfp_sm_read_ordered: Bytes requested are %ld\n",bytesRequested);
|
||||
opal_output(ompi_sharedfp_base_framework.framework_output,
|
||||
"mca_sharedfp_sm_read_ordered: Bytes requested are %ld\n",bytesRequested);
|
||||
}
|
||||
}
|
||||
|
||||
@ -160,7 +166,8 @@ int mca_sharedfp_sm_read_ordered (mca_io_ompio_file_t *fh,
|
||||
goto exit;
|
||||
}
|
||||
if ( mca_sharedfp_sm_verbose ) {
|
||||
printf("mca_sharedfp_sm_read_ordered: Offset received is %lld\n",offsetReceived);
|
||||
opal_output(ompi_sharedfp_base_framework.framework_output,
|
||||
"mca_sharedfp_sm_read_ordered: Offset received is %lld\n",offsetReceived);
|
||||
}
|
||||
|
||||
buff[0] += offsetReceived;
|
||||
@ -180,7 +187,8 @@ int mca_sharedfp_sm_read_ordered (mca_io_ompio_file_t *fh,
|
||||
/*Each process now has its own individual offset in recvBUFF*/
|
||||
offset = offsetBuff - sendBuff;
|
||||
if ( mca_sharedfp_sm_verbose ) {
|
||||
printf("mca_sharedfp_sm_read_ordered: Offset returned is %lld\n",offset);
|
||||
opal_output(ompi_sharedfp_base_framework.framework_output,
|
||||
"mca_sharedfp_sm_read_ordered: Offset returned is %lld\n",offset);
|
||||
}
|
||||
|
||||
/* read to the file */
|
||||
|
@ -25,6 +25,7 @@
|
||||
#include "mpi.h"
|
||||
#include "ompi/constants.h"
|
||||
#include "ompi/mca/sharedfp/sharedfp.h"
|
||||
#include "ompi/mca/sharedfp/base/base.h"
|
||||
|
||||
/*use a semaphore to lock the shared memory*/
|
||||
#include <semaphore.h>
|
||||
@ -42,7 +43,8 @@ int mca_sharedfp_sm_request_position(struct mca_sharedfp_base_data_t * sh,
|
||||
|
||||
*offset = 0;
|
||||
if ( mca_sharedfp_sm_verbose ) {
|
||||
printf("Aquiring lock, rank=%d...",rank);
|
||||
opal_output(ompi_sharedfp_base_framework.framework_output,
|
||||
"Aquiring lock, rank=%d...",rank);
|
||||
}
|
||||
|
||||
sm_offset_ptr = sm_data->sm_offset_ptr;
|
||||
@ -52,28 +54,33 @@ int mca_sharedfp_sm_request_position(struct mca_sharedfp_base_data_t * sh,
|
||||
sem_wait(sm_data->mutex);
|
||||
|
||||
if ( mca_sharedfp_sm_verbose ) {
|
||||
printf("Succeeded! Acquired sm lock.for rank=%d\n",rank);
|
||||
opal_output(ompi_sharedfp_base_framework.framework_output,
|
||||
"Succeeded! Acquired sm lock.for rank=%d\n",rank);
|
||||
}
|
||||
|
||||
old_offset=sm_offset_ptr->offset;
|
||||
if ( mca_sharedfp_sm_verbose ) {
|
||||
printf("Read last_offset=%lld!\n",old_offset);
|
||||
opal_output(ompi_sharedfp_base_framework.framework_output,
|
||||
"Read last_offset=%lld!\n",old_offset);
|
||||
}
|
||||
|
||||
position = old_offset + bytes_requested;
|
||||
if ( mca_sharedfp_sm_verbose ) {
|
||||
printf("old_offset=%lld, bytes_requested=%d, new offset=%lld!\n",old_offset,bytes_requested,position);
|
||||
opal_output(ompi_sharedfp_base_framework.framework_output,
|
||||
"old_offset=%lld, bytes_requested=%d, new offset=%lld!\n",old_offset,bytes_requested,position);
|
||||
}
|
||||
sm_offset_ptr->offset=position;
|
||||
|
||||
|
||||
if ( mca_sharedfp_sm_verbose ) {
|
||||
printf("Releasing sm lock...rank=%d",rank);
|
||||
opal_output(ompi_sharedfp_base_framework.framework_output,
|
||||
"Releasing sm lock...rank=%d",rank);
|
||||
}
|
||||
|
||||
sem_post(sm_data->mutex);
|
||||
if ( mca_sharedfp_sm_verbose ) {
|
||||
printf("Released lock! released lock.for rank=%d\n",rank);
|
||||
opal_output(ompi_sharedfp_base_framework.framework_output,
|
||||
"Released lock! released lock.for rank=%d\n",rank);
|
||||
}
|
||||
|
||||
*offset = old_offset;
|
||||
|
@ -25,6 +25,7 @@
|
||||
#include "mpi.h"
|
||||
#include "ompi/constants.h"
|
||||
#include "ompi/mca/sharedfp/sharedfp.h"
|
||||
#include "ompi/mca/sharedfp/base/base.h"
|
||||
|
||||
/*use a semaphore to lock the shared memory location*/
|
||||
#include <semaphore.h>
|
||||
@ -43,7 +44,8 @@ mca_sharedfp_sm_seek (mca_io_ompio_file_t *fh,
|
||||
|
||||
if( NULL == fh->f_sharedfp_data ) {
|
||||
if ( mca_sharedfp_sm_verbose ) {
|
||||
printf("sharedfp_sm_seek: opening the shared file pointer\n");
|
||||
opal_output(ompi_sharedfp_base_framework.framework_output,
|
||||
"sharedfp_sm_seek: opening the shared file pointer\n");
|
||||
}
|
||||
shared_fp_base_module = fh->f_sharedfp;
|
||||
|
||||
@ -69,19 +71,22 @@ mca_sharedfp_sm_seek (mca_io_ompio_file_t *fh,
|
||||
ret = -1;
|
||||
}
|
||||
if ( mca_sharedfp_sm_verbose ) {
|
||||
printf("sharedfp_sm_seek: MPI_SEEK_SET new_offset=%lld\n",offset);
|
||||
opal_output(ompi_sharedfp_base_framework.framework_output,
|
||||
"sharedfp_sm_seek: MPI_SEEK_SET new_offset=%lld\n",offset);
|
||||
}
|
||||
}
|
||||
else if( MPI_SEEK_CUR == whence){
|
||||
OMPI_MPI_OFFSET_TYPE current_position;
|
||||
ret = mca_sharedfp_sm_get_position ( fh, ¤t_position);
|
||||
if ( mca_sharedfp_sm_verbose ) {
|
||||
printf("sharedfp_sm_seek: MPI_SEEK_CUR: curr=%lld, offset=%lld, call status=%d\n",
|
||||
current_position,offset,status);
|
||||
opal_output(ompi_sharedfp_base_framework.framework_output,
|
||||
"sharedfp_sm_seek: MPI_SEEK_CUR: curr=%lld, offset=%lld, call status=%d\n",
|
||||
current_position,offset,status);
|
||||
}
|
||||
offset = current_position + offset;
|
||||
if ( mca_sharedfp_sm_verbose ) {
|
||||
printf("sharedfp_sm_seek: MPI_SEEK_CUR: new_offset=%lld\n",offset);
|
||||
opal_output(ompi_sharedfp_base_framework.framework_output,
|
||||
"sharedfp_sm_seek: MPI_SEEK_CUR: new_offset=%lld\n",offset);
|
||||
}
|
||||
if(offset < 0){
|
||||
opal_output(0,"sharedfp_sm_seek - MPI_SEEK_CURE, offset must be > 0, got offset=%lld.\n",offset);
|
||||
@ -94,7 +99,8 @@ mca_sharedfp_sm_seek (mca_io_ompio_file_t *fh,
|
||||
|
||||
offset = end_position + offset;
|
||||
if ( mca_sharedfp_sm_verbose ) {
|
||||
printf("sharedfp_sm_seek: MPI_SEEK_END: file_get_size=%lld\n",end_position);
|
||||
opal_output(ompi_sharedfp_base_framework.framework_output,
|
||||
"sharedfp_sm_seek: MPI_SEEK_END: file_get_size=%lld\n",end_position);
|
||||
}
|
||||
if(offset < 0){
|
||||
opal_output(0,"sharedfp_sm_seek - MPI_SEEK_CUR, offset must be > 0, got offset=%lld.\n",offset);
|
||||
@ -116,7 +122,8 @@ mca_sharedfp_sm_seek (mca_io_ompio_file_t *fh,
|
||||
/*lock the file */
|
||||
/*--------------------*/
|
||||
if ( mca_sharedfp_sm_verbose ) {
|
||||
printf("sharedfp_sm_seek: Aquiring lock, rank=%d...",rank); fflush(stdout);
|
||||
opal_output(ompi_sharedfp_base_framework.framework_output,
|
||||
"sharedfp_sm_seek: Aquiring lock, rank=%d...",rank); fflush(stdout);
|
||||
}
|
||||
|
||||
/* Aquire an exclusive lock */
|
||||
@ -125,11 +132,13 @@ mca_sharedfp_sm_seek (mca_io_ompio_file_t *fh,
|
||||
sem_wait(sm_data->mutex);
|
||||
|
||||
if ( mca_sharedfp_sm_verbose ) {
|
||||
printf("sharedfp_sm_seek: Success! Acquired sm lock.for rank=%d\n",rank);
|
||||
opal_output(ompi_sharedfp_base_framework.framework_output,
|
||||
"sharedfp_sm_seek: Success! Acquired sm lock.for rank=%d\n",rank);
|
||||
}
|
||||
sm_offset_ptr->offset=offset;
|
||||
if ( mca_sharedfp_sm_verbose ) {
|
||||
printf("sharedfp_sm_seek: Releasing sm lock...rank=%d",rank); fflush(stdout);
|
||||
opal_output(ompi_sharedfp_base_framework.framework_output,
|
||||
"sharedfp_sm_seek: Releasing sm lock...rank=%d",rank); fflush(stdout);
|
||||
}
|
||||
sem_post(sm_data->mutex);
|
||||
}
|
||||
|
@ -9,7 +9,7 @@
|
||||
* University of Stuttgart. All rights reserved.
|
||||
* Copyright (c) 2004-2005 The Regents of the University of California.
|
||||
* All rights reserved.
|
||||
* Copyright (c) 2013 University of Houston. All rights reserved.
|
||||
* Copyright (c) 2013-2015 University of Houston. All rights reserved.
|
||||
* $COPYRIGHT$
|
||||
*
|
||||
* Additional copyrights may follow
|
||||
@ -24,6 +24,7 @@
|
||||
#include "mpi.h"
|
||||
#include "ompi/constants.h"
|
||||
#include "ompi/mca/sharedfp/sharedfp.h"
|
||||
#include "ompi/mca/sharedfp/base/base.h"
|
||||
|
||||
int mca_sharedfp_sm_write (mca_io_ompio_file_t *fh,
|
||||
void *buf,
|
||||
@ -40,7 +41,8 @@ int mca_sharedfp_sm_write (mca_io_ompio_file_t *fh,
|
||||
|
||||
if( NULL == fh->f_sharedfp_data ){
|
||||
if ( mca_sharedfp_sm_verbose ) {
|
||||
printf("sharedfp_sm_write: opening the shared file pointer\n");
|
||||
opal_output(ompi_sharedfp_base_framework.framework_output,
|
||||
"sharedfp_sm_write: opening the shared file pointer\n");
|
||||
}
|
||||
shared_fp_base_module = fh->f_sharedfp;
|
||||
|
||||
@ -63,14 +65,16 @@ int mca_sharedfp_sm_write (mca_io_ompio_file_t *fh,
|
||||
sh = fh->f_sharedfp_data;
|
||||
|
||||
if ( mca_sharedfp_sm_verbose ) {
|
||||
printf("sharedfp_sm_write: Requested is %ld\n",bytesRequested);
|
||||
opal_output(ompi_sharedfp_base_framework.framework_output,
|
||||
"sharedfp_sm_write: Requested is %ld\n",bytesRequested);
|
||||
}
|
||||
|
||||
/*Request the offset to write bytesRequested bytes*/
|
||||
ret = mca_sharedfp_sm_request_position(sh,bytesRequested,&offset);
|
||||
if ( -1 != ret ) {
|
||||
if ( mca_sharedfp_sm_verbose ) {
|
||||
printf("sharedfp_sm_write: fset received is %lld\n",offset);
|
||||
opal_output(ompi_sharedfp_base_framework.framework_output,
|
||||
"sharedfp_sm_write: fset received is %lld\n",offset);
|
||||
}
|
||||
|
||||
/* Write to the file*/
|
||||
@ -103,7 +107,8 @@ int mca_sharedfp_sm_write_ordered (mca_io_ompio_file_t *fh,
|
||||
|
||||
if( NULL == fh->f_sharedfp_data){
|
||||
if ( mca_sharedfp_sm_verbose ) {
|
||||
printf("sharedfp_sm_write_ordered: opening the shared file pointer\n");
|
||||
opal_output(ompi_sharedfp_base_framework.framework_output,
|
||||
"sharedfp_sm_write_ordered: opening the shared file pointer\n");
|
||||
}
|
||||
shared_fp_base_module = fh->f_sharedfp;
|
||||
|
||||
@ -150,7 +155,8 @@ int mca_sharedfp_sm_write_ordered (mca_io_ompio_file_t *fh,
|
||||
for (i = 0; i < size ; i ++) {
|
||||
bytesRequested += buff[i];
|
||||
if ( mca_sharedfp_sm_verbose ) {
|
||||
printf("sharedfp_sm_write_ordered: Bytes requested are %ld\n",bytesRequested);
|
||||
opal_output(ompi_sharedfp_base_framework.framework_output,
|
||||
"sharedfp_sm_write_ordered: Bytes requested are %ld\n",bytesRequested);
|
||||
}
|
||||
}
|
||||
|
||||
@ -165,7 +171,8 @@ int mca_sharedfp_sm_write_ordered (mca_io_ompio_file_t *fh,
|
||||
goto exit;
|
||||
}
|
||||
if ( mca_sharedfp_sm_verbose ) {
|
||||
printf("sharedfp_sm_write_ordered: Offset received is %lld\n",offsetReceived);
|
||||
opal_output(ompi_sharedfp_base_framework.framework_output,
|
||||
"sharedfp_sm_write_ordered: Offset received is %lld\n",offsetReceived);
|
||||
}
|
||||
buff[0] += offsetReceived;
|
||||
|
||||
@ -187,7 +194,8 @@ int mca_sharedfp_sm_write_ordered (mca_io_ompio_file_t *fh,
|
||||
offset = offsetBuff - sendBuff;
|
||||
|
||||
if ( mca_sharedfp_sm_verbose ) {
|
||||
printf("sharedfp_sm_write_ordered: Offset returned is %lld\n",offset);
|
||||
opal_output(ompi_sharedfp_base_framework.framework_output,
|
||||
"sharedfp_sm_write_ordered: Offset returned is %lld\n",offset);
|
||||
}
|
||||
/* write to the file */
|
||||
ret = ompio_io_ompio_file_write_at_all(sh->sharedfh,offset,buf,count,datatype,status);
|
||||
|
Loading…
x
Reference in New Issue
Block a user