first cut on moving some ompio functionality to common/ompio
Этот коммит содержится в:
родитель
941d4fdb8b
Коммит
af67c8f239
82
ompi/mca/common/ompio/Makefile.am
Обычный файл
82
ompi/mca/common/ompio/Makefile.am
Обычный файл
@ -0,0 +1,82 @@
|
||||
#
|
||||
# Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
|
||||
# University Research and Technology
|
||||
# Corporation. All rights reserved.
|
||||
# Copyright (c) 2004-2007 The University of Tennessee and The University
|
||||
# of Tennessee Research Foundation. All rights
|
||||
# reserved.
|
||||
# Copyright (c) 2004-2005 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-2016 University of Houston. All rights reserved.
|
||||
#
|
||||
# $COPYRIGHT$
|
||||
#
|
||||
# Additional copyrights may follow
|
||||
#
|
||||
# $HEADER$
|
||||
#
|
||||
|
||||
headers = \
|
||||
common_ompio_print_queue.h
|
||||
|
||||
sources = \
|
||||
common_ompio_print_queue.c
|
||||
|
||||
|
||||
# To simplify components that link to this library, we will *always*
|
||||
# have an output libtool library named libmca_<type>_<name>.la -- even
|
||||
# for case 2) described above (i.e., so there's no conditional logic
|
||||
# necessary in component Makefile.am's that link to this library).
|
||||
# Hence, if we're creating a noinst version of this library (i.e.,
|
||||
# case 2), we sym link it to the libmca_<type>_<name>.la name
|
||||
# (libtool will do the Right Things under the covers). See the
|
||||
# all-local and clean-local rules, below, for how this is effected.
|
||||
|
||||
lib_LTLIBRARIES =
|
||||
noinst_LTLIBRARIES =
|
||||
comp_inst = lib@OPAL_LIB_PREFIX@mca_common_ompio.la
|
||||
comp_noinst = lib@OPAL_LIB_PREFIX@mca_common_ompio_noinst.la
|
||||
|
||||
if MCA_BUILD_ompi_common_ompio_DSO
|
||||
lib_LTLIBRARIES += $(comp_inst)
|
||||
else
|
||||
noinst_LTLIBRARIES += $(comp_noinst)
|
||||
endif
|
||||
|
||||
lib@OPAL_LIB_PREFIX@mca_common_ompio_la_SOURCES = $(headers) $(sources)
|
||||
lib@OPAL_LIB_PREFIX@mca_common_ompio_la_CPPFLAGS = $(common_ompio_CPPFLAGS)
|
||||
lib@OPAL_LIB_PREFIX@mca_common_ompio_la_LDFLAGS = \
|
||||
-version-info $(libmca_opal_common_ompio_so_version) \
|
||||
$(common_ompio_LDFLAGS)
|
||||
lib@OPAL_LIB_PREFIX@mca_common_ompio_la_LIBADD = $(common_ompio_LIBS)
|
||||
lib@OPAL_LIB_PREFIX@mca_common_ompio_noinst_la_SOURCES = $(headers) $(sources)
|
||||
|
||||
# Conditionally install the header files
|
||||
|
||||
if WANT_INSTALL_HEADERS
|
||||
ompidir = $(ompiincludedir)/ompi/mca/common/ompio
|
||||
ompi_HEADERS = $(headers)
|
||||
else
|
||||
ompidir = $(includedir)
|
||||
endif
|
||||
|
||||
# These two rules will sym link the "noinst" libtool library filename
|
||||
# to the installable libtool library filename in the case where we are
|
||||
# compiling this component statically (case 2), described above).
|
||||
V=0
|
||||
OMPI_V_LN_SCOMP = $(ompi__v_LN_SCOMP_$V)
|
||||
ompi__v_LN_SCOMP_ = $(ompi__v_LN_SCOMP_$AM_DEFAULT_VERBOSITY)
|
||||
ompi__v_LN_SCOMP_0 = @echo " LN_S " `basename $(comp_inst)`;
|
||||
|
||||
all-local:
|
||||
$(OMPI_V_LN_SCOMP) if test -z "$(lib_LTLIBRARIES)"; then \
|
||||
rm -f "$(comp_inst)"; \
|
||||
$(LN_S) "$(comp_noinst)" "$(comp_inst)"; \
|
||||
fi
|
||||
|
||||
clean-local:
|
||||
if test -z "$(lib_LTLIBRARIES)"; then \
|
||||
rm -f "$(comp_inst)"; \
|
||||
fi
|
293
ompi/mca/common/ompio/common_ompio_print_queue.c
Обычный файл
293
ompi/mca/common/ompio/common_ompio_print_queue.c
Обычный файл
@ -0,0 +1,293 @@
|
||||
/* -*- Mode: C; c-basic-offset:4 ; -*- */
|
||||
/*
|
||||
* Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
|
||||
* University Research and Technology
|
||||
* Corporation. All rights reserved.
|
||||
* Copyright (c) 2004-2013 The University of Tennessee and The University
|
||||
* of Tennessee Research Foundation. All rights
|
||||
* reserved.
|
||||
* Copyright (c) 2004-2005 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-2016 University of Houston. All rights reserved.
|
||||
* Copyright (c) 2011-2015 Cisco Systems, Inc. All rights reserved.
|
||||
* Copyright (c) 2012-2013 Inria. All rights reserved.
|
||||
* Copyright (c) 2015 Research Organization for Information Science
|
||||
* and Technology (RIST). All rights reserved.
|
||||
* $COPYRIGHT$
|
||||
*
|
||||
* Additional copyrights may follow
|
||||
*
|
||||
* $HEADER$
|
||||
*/
|
||||
|
||||
#include "ompi_config.h"
|
||||
|
||||
#include "ompi/communicator/communicator.h"
|
||||
#include "ompi/datatype/ompi_datatype.h"
|
||||
|
||||
#include "common_ompio_print_queue.h"
|
||||
|
||||
mca_common_ompio_print_queue *coll_write_time=NULL;
|
||||
mca_common_ompio_print_queue *coll_read_time=NULL;
|
||||
|
||||
/* Print queue related function implementations */
|
||||
int common_ompio_set_print_queue (mca_common_ompio_print_queue **q,
|
||||
int queue_type){
|
||||
|
||||
int ret = OMPI_SUCCESS;
|
||||
|
||||
switch(queue_type) {
|
||||
|
||||
case WRITE_PRINT_QUEUE:
|
||||
*q = coll_write_time;
|
||||
break;
|
||||
case READ_PRINT_QUEUE:
|
||||
*q = coll_read_time;
|
||||
break;
|
||||
}
|
||||
|
||||
if (NULL == q){
|
||||
ret = OMPI_ERROR;
|
||||
}
|
||||
return ret;
|
||||
|
||||
}
|
||||
|
||||
|
||||
int common_ompio_initialize_print_queue(void *r){
|
||||
|
||||
mca_common_ompio_print_queue *q;
|
||||
int ret = OMPI_SUCCESS;
|
||||
|
||||
q = (mca_common_ompio_print_queue *) malloc ( sizeof(mca_common_ompio_print_queue));
|
||||
if ( NULL == q ) {
|
||||
ret = OMPI_ERR_OUT_OF_RESOURCE;
|
||||
}
|
||||
q->first = 0;
|
||||
q->last = COMMON_OMPIO_QUEUESIZE - 1;
|
||||
q->count = 0;
|
||||
|
||||
*r = ( void *) *q;
|
||||
return ret;
|
||||
}
|
||||
int common_ompio_register_print_entry (int queue_type,
|
||||
mca_common_ompio_print_entry x){
|
||||
|
||||
int ret = OMPI_SUCCESS;
|
||||
mca_common_ompio_print_queue *q=NULL;
|
||||
|
||||
ret = common_ompio_set_print_queue(&q, queue_type);
|
||||
|
||||
if (ret != OMPI_ERROR){
|
||||
if (q->count >= COMMON_OMPIO_QUEUESIZE){
|
||||
return OMPI_ERROR;
|
||||
}
|
||||
else{
|
||||
q->last = (q->last + 1) % COMMON_OMPIO_QUEUESIZE;
|
||||
q->entry[q->last] = x;
|
||||
q->count = q->count + 1;
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
int common_ompio_unregister_print_entry (int queue_type,
|
||||
mca_common_ompio_print_entry *x){
|
||||
|
||||
int ret = OMPI_SUCCESS;
|
||||
mca_common_ompio_print_queue *q=NULL;
|
||||
ret = common_ompio_set_print_queue(&q, queue_type);
|
||||
if (ret != OMPI_ERROR){
|
||||
if (q->count <= 0){
|
||||
return OMPI_ERROR;
|
||||
}
|
||||
else{
|
||||
*x = q->entry[q->first];
|
||||
q->first = (q->first+1) % COMMON_OMPIO_QUEUESIZE;
|
||||
q->count = q->count - 1;
|
||||
}
|
||||
}
|
||||
return OMPI_SUCCESS;
|
||||
}
|
||||
|
||||
int common_ompio_empty_print_queue(int queue_type){
|
||||
|
||||
int ret = OMPI_SUCCESS;
|
||||
mca_common_ompio_print_queue *q=NULL;
|
||||
ret = common_ompio_set_print_queue(&q, queue_type);
|
||||
|
||||
assert (ret != OMPI_ERROR);
|
||||
(void)ret; // silence compiler warning
|
||||
if (q->count == 0)
|
||||
return 1;
|
||||
else
|
||||
return 0;
|
||||
|
||||
|
||||
}
|
||||
|
||||
int common_ompio_full_print_queue(int queue_type){
|
||||
|
||||
|
||||
int ret = OMPI_SUCCESS;
|
||||
mca_common_ompio_print_queue *q=NULL;
|
||||
ret = common_ompio_set_print_queue(&q, queue_type);
|
||||
|
||||
assert ( ret != OMPI_ERROR);
|
||||
(void)ret; // silence compiler warning
|
||||
if (q->count < COMMON_OMPIO_QUEUESIZE)
|
||||
return 0;
|
||||
else
|
||||
return 1;
|
||||
|
||||
}
|
||||
|
||||
|
||||
int common_ompio_print_time_info(int queue_type,
|
||||
char *name,
|
||||
mca_io_ompio_file_t *fh){
|
||||
|
||||
int i = 0, j=0, nprocs_for_coll = 0, ret = OMPI_SUCCESS, count = 0;
|
||||
double *time_details = NULL, *final_sum = NULL;
|
||||
double *final_max = NULL, *final_min = NULL;
|
||||
double *final_time_details=NULL;
|
||||
mca_common_ompio_print_queue *q=NULL;
|
||||
|
||||
ret = common_ompio_set_print_queue(&q, queue_type);
|
||||
|
||||
assert (ret != OMPI_ERROR);
|
||||
nprocs_for_coll = q->entry[0].nprocs_for_coll;
|
||||
time_details = (double *) malloc (4*sizeof(double));
|
||||
if ( NULL == time_details){
|
||||
ret = OMPI_ERR_OUT_OF_RESOURCE;
|
||||
goto exit;
|
||||
|
||||
}
|
||||
|
||||
if (!fh->f_rank){
|
||||
|
||||
final_min = (double *) malloc (3*sizeof(double));
|
||||
if ( NULL == final_min){
|
||||
ret = OMPI_ERR_OUT_OF_RESOURCE;
|
||||
goto exit;
|
||||
}
|
||||
|
||||
final_max = (double *) malloc (3*sizeof(double));
|
||||
if ( NULL == final_max){
|
||||
ret = OMPI_ERR_OUT_OF_RESOURCE;
|
||||
goto exit;
|
||||
|
||||
}
|
||||
|
||||
final_sum = (double *) malloc (3*sizeof(double));
|
||||
if ( NULL == final_sum){
|
||||
ret = OMPI_ERR_OUT_OF_RESOURCE;
|
||||
goto exit;
|
||||
}
|
||||
|
||||
final_time_details =
|
||||
(double *)malloc
|
||||
(fh->f_size * 4 * sizeof(double));
|
||||
if (NULL == final_time_details){
|
||||
ret = OMPI_ERR_OUT_OF_RESOURCE;
|
||||
goto exit;
|
||||
}
|
||||
|
||||
count = 4 * fh->f_size;
|
||||
for(i=0;i<count;i++){
|
||||
final_time_details[i] = 0.0;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
for (i = 0; i < 4; i++){
|
||||
time_details[i] = 0.0;
|
||||
}
|
||||
|
||||
if (q->count > 0){
|
||||
for (i=0; i < q->count; i++){
|
||||
for (j=0;j<3;j++){
|
||||
if (!fh->f_rank){
|
||||
final_min[j] = 100000.0;
|
||||
final_max[j] = 0.0;
|
||||
final_sum[j] = 0.0;
|
||||
}
|
||||
time_details[j] += q->entry[i].time[j];
|
||||
}
|
||||
time_details[3] = q->entry[i].aggregator;
|
||||
}
|
||||
}
|
||||
|
||||
fh->f_comm->c_coll.coll_gather(time_details,
|
||||
4,
|
||||
MPI_DOUBLE,
|
||||
final_time_details,
|
||||
4,
|
||||
MPI_DOUBLE,
|
||||
0,
|
||||
fh->f_comm,
|
||||
fh->f_comm->c_coll.coll_gather_module);
|
||||
|
||||
|
||||
|
||||
if (!fh->f_rank){
|
||||
|
||||
for (i=0;i<count;i+=4){
|
||||
if (final_time_details[i+3] == 1){
|
||||
final_sum[0] += final_time_details[i];
|
||||
final_sum[1] += final_time_details[i+1];
|
||||
final_sum[2] += final_time_details[i+2];
|
||||
|
||||
if ( final_time_details[i] < final_min[0])
|
||||
final_min[0] = final_time_details[i];
|
||||
if ( final_time_details[i+1] < final_min[1])
|
||||
final_min[1] = final_time_details[i+1];
|
||||
if ( final_time_details[i+2] < final_min[2])
|
||||
final_min[2] = final_time_details[i+2];
|
||||
|
||||
|
||||
|
||||
if ( final_time_details[i] > final_max[0])
|
||||
final_max[0] = final_time_details[i];
|
||||
if ( final_time_details[i+1] > final_max[1])
|
||||
final_max[1] = final_time_details[i+1];
|
||||
if ( final_time_details[i+2] > final_max[2])
|
||||
final_max[2] = final_time_details[i+2];
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
printf ("\n# MAX-%s AVG-%s MIN-%s MAX-COMM AVG-COMM MIN-COMM",
|
||||
name, name, name);
|
||||
printf (" MAX-EXCH AVG-EXCH MIN-EXCH\n");
|
||||
printf (" %f %f %f %f %f %f %f %f %f\n\n",
|
||||
final_max[0], final_sum[0]/nprocs_for_coll, final_min[0],
|
||||
final_max[1], final_sum[1]/nprocs_for_coll, final_min[1],
|
||||
final_max[2], final_sum[2]/nprocs_for_coll, final_min[2]);
|
||||
|
||||
}
|
||||
|
||||
exit:
|
||||
if ( NULL != final_max){
|
||||
free(final_max);
|
||||
final_max = NULL;
|
||||
}
|
||||
if (NULL != final_min){
|
||||
free(final_min);
|
||||
final_min = NULL;
|
||||
}
|
||||
if (NULL != final_sum){
|
||||
free(final_sum);
|
||||
final_sum = NULL;
|
||||
}
|
||||
if (NULL != time_details){
|
||||
free(time_details);
|
||||
time_details = NULL;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
79
ompi/mca/common/ompio/common_ompio_print_queue.h
Обычный файл
79
ompi/mca/common/ompio/common_ompio_print_queue.h
Обычный файл
@ -0,0 +1,79 @@
|
||||
/* -*- Mode: C; c-basic-offset:4 ; -*- */
|
||||
/*
|
||||
* Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
|
||||
* University Research and Technology
|
||||
* Corporation. All rights reserved.
|
||||
* Copyright (c) 2004-2007 The University of Tennessee and The University
|
||||
* of Tennessee Research Foundation. All rights
|
||||
* reserved.
|
||||
* Copyright (c) 2004-2005 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-2016 University of Houston. All rights reserved.
|
||||
* Copyright (c) 2015 Research Organization for Information Science
|
||||
* and Technology (RIST). All rights reserved.
|
||||
* $COPYRIGHT$
|
||||
*
|
||||
* Additional copyrights may follow
|
||||
*
|
||||
* $HEADER$
|
||||
*/
|
||||
|
||||
#ifndef MCA_COMMON_OMPIO_PRINT_QUEUE_H
|
||||
#define MCA_COMMON_OMPIO_PRINT_QUEUE_H
|
||||
|
||||
|
||||
#include "mpi.h"
|
||||
#include "ompi/mca/io/ompio/io_ompio.h"
|
||||
|
||||
OMPI_DECLSPEC extern int mca_io_ompio_coll_timing_info;
|
||||
|
||||
#define COMMON_OMPIO_QUEUESIZE 2048
|
||||
|
||||
/* PRINT QUEUES*/
|
||||
#define WRITE_PRINT_QUEUE 1809
|
||||
#define READ_PRINT_QUEUE 2178
|
||||
/*---------------------------*/
|
||||
|
||||
/*To extract time-information */
|
||||
typedef struct {
|
||||
double time[3];
|
||||
int nprocs_for_coll;
|
||||
int aggregator;
|
||||
}mca_common_ompio_print_entry;
|
||||
|
||||
typedef struct {
|
||||
mca_common_ompio_print_entry entry[COMMON_OMPIO_QUEUESIZE + 1];
|
||||
int first;
|
||||
int last;
|
||||
int count;
|
||||
} mca_common_ompio_print_queue;
|
||||
|
||||
|
||||
OMPI_DECLSPEC extern mca_common_ompio_print_queue *coll_write_time;
|
||||
OMPI_DECLSPEC extern mca_common_ompio_print_queue *coll_read_time;
|
||||
|
||||
|
||||
OMPI_DECLSPEC int common_ompio_register_print_entry (int queue_type,
|
||||
mca_common_ompio_print_entry x);
|
||||
|
||||
OMPI_DECLSPEC int common_ompio_unregister_print_entry (int queue_type,
|
||||
mca_common_ompio_print_entry *x);
|
||||
|
||||
OMPI_DECLSPEC int common_ompio_empty_print_queue(int queue_type);
|
||||
|
||||
OMPI_DECLSPEC int common_ompio_full_print_queue(int queue_type);
|
||||
|
||||
OMPI_DECLSPEC int common_ompio_initialize_print_queue(mca_common_ompio_print_queue *q);
|
||||
|
||||
OMPI_DECLSPEC int common_ompio_print_time_info(int queue_type,
|
||||
char *name_operation,
|
||||
mca_io_ompio_file_t *fh);
|
||||
int common_ompio_set_print_queue (mca_common_ompio_print_queue **q,
|
||||
int queue_type);
|
||||
|
||||
|
||||
END_C_DECLS
|
||||
|
||||
#endif /* MCA_COMMON_OMPIO_PRINT_QUEUE_H */
|
@ -341,8 +341,8 @@ struct mca_io_ompio_data_t {
|
||||
};
|
||||
typedef struct mca_io_ompio_data_t mca_io_ompio_data_t;
|
||||
|
||||
OMPI_DECLSPEC extern mca_io_ompio_print_queue *coll_write_time;
|
||||
OMPI_DECLSPEC extern mca_io_ompio_print_queue *coll_read_time;
|
||||
//OMPI_DECLSPEC extern mca_io_ompio_print_queue *coll_write_time;
|
||||
// OMPI_DECLSPEC extern mca_io_ompio_print_queue *coll_read_time;
|
||||
|
||||
/* functions to retrieve the number of aggregators and the size of the
|
||||
temporary buffer on aggregators from the fcoll modules */
|
||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user