1
1

Remove "compress" OPAL framework

This framework is no longer used.

Signed-off-by: Jeff Squyres <jsquyres@cisco.com>
Этот коммит содержится в:
Jeff Squyres 2020-02-21 06:28:16 -08:00
родитель 3366f3ec40
Коммит 66da0c6361
39 изменённых файлов: 2 добавлений и 2985 удалений

Просмотреть файл

@ -1,36 +0,0 @@
#
# Copyright (c) 2004-2010 The Trustees of Indiana University and Indiana
# University Research and Technology
# Corporation. All rights reserved.
# Copyright (c) 2010-2014 Cisco Systems, Inc. All rights reserved.
# $COPYRIGHT$
#
# Additional copyrights may follow
#
# $HEADER$
#
# main library setup
noinst_LTLIBRARIES = libmca_compress.la
libmca_compress_la_SOURCES =
# local files
headers = compress.h
libmca_compress_la_SOURCES += $(headers)
# Ensure that the man pages are rebuilt if the opal_config.h file
# changes; a "good enough" way to know if configure was run again (and
# therefore the release date or version may have changed)
$(nodist_man_MANS): $(top_builddir)/opal/include/opal_config.h
# Conditionally install the header files
if WANT_INSTALL_HEADERS
opaldir = $(opalincludedir)/$(subdir)
nobase_opal_HEADERS = $(headers)
endif
include base/Makefile.am
distclean-local:
rm -f base/static-components.h
rm -f $(nodist_man_MANS)

Просмотреть файл

@ -1,20 +0,0 @@
#
# Copyright (c) 2004-2010 The Trustees of Indiana University and Indiana
# University Research and Technology
# Corporation. All rights reserved.
# Copyright (c) 2014 Cisco Systems, Inc. All rights reserved.
# Copyright (c) 2019 Intel, Inc. All rights reserved.
# $COPYRIGHT$
#
# Additional copyrights may follow
#
# $HEADER$
#
headers += \
base/base.h
libmca_compress_la_SOURCES += \
base/compress_base_frame.c \
base/compress_base_select.c \
base/compress_base_fns.c

Просмотреть файл

@ -1,84 +0,0 @@
/*
* Copyright (c) 2004-2010 The Trustees of Indiana University and Indiana
* University Research and Technology
* Corporation. All rights reserved.
*
* Copyright (c) 2019 Intel, Inc. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
#ifndef OPAL_COMPRESS_BASE_H
#define OPAL_COMPRESS_BASE_H
#include "opal_config.h"
#include "opal/mca/compress/compress.h"
#include "opal/util/opal_environ.h"
#include "opal/runtime/opal_cr.h"
#include "opal/mca/base/base.h"
/*
* Global functions for MCA overall COMPRESS
*/
#if defined(c_plusplus) || defined(__cplusplus)
extern "C" {
#endif
typedef struct {
size_t compress_limit;
} opal_compress_base_t;
OPAL_DECLSPEC extern opal_compress_base_t opal_compress_base;
/**
* Initialize the COMPRESS MCA framework
*
* @retval OPAL_SUCCESS Upon success
* @retval OPAL_ERROR Upon failures
*
* This function is invoked during opal_init();
*/
OPAL_DECLSPEC int opal_compress_base_open(mca_base_open_flag_t flags);
/**
* Select an available component.
*
* @retval OPAL_SUCCESS Upon Success
* @retval OPAL_NOT_FOUND If no component can be selected
* @retval OPAL_ERROR Upon other failure
*
*/
OPAL_DECLSPEC int opal_compress_base_select(void);
/**
* Finalize the COMPRESS MCA framework
*
* @retval OPAL_SUCCESS Upon success
* @retval OPAL_ERROR Upon failures
*
* This function is invoked during opal_finalize();
*/
OPAL_DECLSPEC int opal_compress_base_close(void);
/**
* Globals
*/
OPAL_DECLSPEC extern mca_base_framework_t opal_compress_base_framework;
OPAL_DECLSPEC extern opal_compress_base_component_t opal_compress_base_selected_component;
OPAL_DECLSPEC extern opal_compress_base_module_t opal_compress;
/**
*
*/
OPAL_DECLSPEC int opal_compress_base_tar_create(char ** target);
OPAL_DECLSPEC int opal_compress_base_tar_extract(char ** target);
#if defined(c_plusplus) || defined(__cplusplus)
}
#endif
#endif /* OPAL_COMPRESS_BASE_H */

Просмотреть файл

@ -1,137 +0,0 @@
/*
* Copyright (c) 2004-2010 The Trustees of Indiana University.
* All rights reserved.
* Copyright (c) 2015 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
*
* Copyright (c) 2018 Amazon.com, Inc. or its affiliates. All Rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
#include "opal_config.h"
#include <string.h>
#include <sys/wait.h>
#if HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#if HAVE_UNISTD_H
#include <unistd.h>
#endif
#ifdef HAVE_FCNTL_H
#include <fcntl.h>
#endif /* HAVE_FCNTL_H */
#ifdef HAVE_SYS_STAT_H
#include <sys/stat.h>
#endif
#include "opal/mca/mca.h"
#include "opal/mca/base/base.h"
#include "opal/include/opal/constants.h"
#include "opal/util/os_dirpath.h"
#include "opal/util/output.h"
#include "opal/util/argv.h"
#include "opal/util/printf.h"
#include "opal/mca/compress/compress.h"
#include "opal/mca/compress/base/base.h"
/******************
* Local Function Defs
******************/
/******************
* Object stuff
******************/
int opal_compress_base_tar_create(char ** target)
{
int exit_status = OPAL_SUCCESS;
char *tar_target = NULL;
char **argv = NULL;
pid_t child_pid = 0;
int status = 0;
opal_asprintf(&tar_target, "%s.tar", *target);
child_pid = fork();
if( 0 == child_pid ) { /* Child */
char *cmd;
opal_asprintf(&cmd, "tar -cf %s %s", tar_target, *target);
argv = opal_argv_split(cmd, ' ');
status = execvp(argv[0], argv);
opal_output(0, "compress:base: Tar:: Failed to exec child [%s] status = %d\n", cmd, status);
exit(OPAL_ERROR);
}
else if(0 < child_pid) {
waitpid(child_pid, &status, 0);
if( !WIFEXITED(status) ) {
exit_status = OPAL_ERROR;
goto cleanup;
}
free(*target);
*target = strdup(tar_target);
}
else {
exit_status = OPAL_ERROR;
goto cleanup;
}
cleanup:
if( NULL != tar_target ) {
free(tar_target);
}
return exit_status;
}
int opal_compress_base_tar_extract(char ** target)
{
int exit_status = OPAL_SUCCESS;
char **argv = NULL;
pid_t child_pid = 0;
int status = 0;
child_pid = fork();
if( 0 == child_pid ) { /* Child */
char *cmd;
opal_asprintf(&cmd, "tar -xf %s", *target);
argv = opal_argv_split(cmd, ' ');
status = execvp(argv[0], argv);
opal_output(0, "compress:base: Tar:: Failed to exec child [%s] status = %d\n", cmd, status);
exit(OPAL_ERROR);
}
else if(0 < child_pid) {
waitpid(child_pid, &status, 0);
if( !WIFEXITED(status) ) {
exit_status = OPAL_ERROR;
goto cleanup;
}
/* Strip off the '.tar' */
(*target)[strlen(*target)-4] = '\0';
}
else {
exit_status = OPAL_ERROR;
goto cleanup;
}
cleanup:
return exit_status;
}
/******************
* Local Functions
******************/

Просмотреть файл

@ -1,91 +0,0 @@
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
/*
* Copyright (c) 2004-2010 The Trustees of Indiana University.
* All rights reserved.
* Copyright (c) 2011-2013 Los Alamos National Security, LLC.
* All rights reserved.
* Copyright (c) 2015 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
* Copyright (c) 2019 Intel, Inc. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
#include "opal_config.h"
#include "opal/mca/base/base.h"
#include "opal/mca/compress/base/base.h"
#include "opal/mca/compress/base/static-components.h"
/*
* Globals
*/
static bool compress_block(uint8_t *inbytes,
size_t inlen,
uint8_t **outbytes,
size_t *olen)
{
return false;
}
static bool decompress_block(uint8_t **outbytes, size_t olen,
uint8_t *inbytes, size_t len)
{
return false;
}
opal_compress_base_module_t opal_compress = {
NULL, /* init */
NULL, /* finalize */
NULL, /* compress */
NULL, /* compress_nb */
NULL, /* decompress */
NULL, /* decompress_nb */
compress_block,
decompress_block
};
opal_compress_base_t opal_compress_base = {0};
opal_compress_base_component_t opal_compress_base_selected_component = {{0}};
static int opal_compress_base_register(mca_base_register_flag_t flags);
MCA_BASE_FRAMEWORK_DECLARE(opal, compress, "COMPRESS MCA",
opal_compress_base_register, opal_compress_base_open,
opal_compress_base_close, mca_compress_base_static_components, 0);
static int opal_compress_base_register(mca_base_register_flag_t flags)
{
opal_compress_base.compress_limit = 4096;
(void) mca_base_var_register("opal", "compress", "base", "limit",
"Threshold beyond which data will be compressed",
MCA_BASE_VAR_TYPE_SIZE_T, NULL, 0, 0, OPAL_INFO_LVL_3,
MCA_BASE_VAR_SCOPE_READONLY, &opal_compress_base.compress_limit);
return OPAL_SUCCESS;
}
/**
* Function for finding and opening either all MCA components,
* or the one that was specifically requested via a MCA parameter.
*/
int opal_compress_base_open(mca_base_open_flag_t flags)
{
/* Open up all available components */
return mca_base_framework_components_open(&opal_compress_base_framework, flags);
}
int opal_compress_base_close(void)
{
/* Call the component's finalize routine */
if( NULL != opal_compress.finalize ) {
opal_compress.finalize();
}
/* Close all available modules that are open */
return mca_base_framework_components_close (&opal_compress_base_framework, NULL);
}

Просмотреть файл

@ -1,62 +0,0 @@
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
/*
* Copyright (c) 2004-2010 The Trustees of Indiana University.
* All rights reserved.
* Copyright (c) 2015 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
*
* Copyright (c) 2015 Los Alamos National Security, LLC. All rights
* reserved.
* Copyright (c) 2019 Intel, Inc. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
#include "opal_config.h"
#ifdef HAVE_UNISTD_H
#include "unistd.h"
#endif
#include "opal/include/opal/constants.h"
#include "opal/util/output.h"
#include "opal/mca/mca.h"
#include "opal/mca/base/base.h"
#include "opal/mca/compress/compress.h"
#include "opal/mca/compress/base/base.h"
int opal_compress_base_select(void)
{
int ret = OPAL_SUCCESS;
opal_compress_base_component_t *best_component = NULL;
opal_compress_base_module_t *best_module = NULL;
/*
* Select the best component
*/
if( OPAL_SUCCESS != mca_base_select("compress", opal_compress_base_framework.framework_output,
&opal_compress_base_framework.framework_components,
(mca_base_module_t **) &best_module,
(mca_base_component_t **) &best_component, NULL) ) {
/* This will only happen if no component was selected,
* in which case we use the default one */
goto cleanup;
}
/* Save the winner */
opal_compress_base_selected_component = *best_component;
/* Initialize the winner */
if (NULL != best_module) {
if (OPAL_SUCCESS != (ret = best_module->init()) ) {
goto cleanup;
}
opal_compress = *best_module;
}
cleanup:
return ret;
}

Просмотреть файл

@ -1,7 +0,0 @@
#
# owner/status file
# owner: institution that is responsible for this package
# status: e.g. active, maintenance, unmaintained
#
owner:project
status:maintenance

Просмотреть файл

Просмотреть файл

@ -1,38 +0,0 @@
#
# Copyright (c) 2004-2010 The Trustees of Indiana University.
# All rights reserved.
# Copyright (c) 2014-2015 Cisco Systems, Inc. All rights reserved.
# Copyright (c) 2017 IBM Corporation. All rights reserved.
# $COPYRIGHT$
#
# Additional copyrights may follow
#
# $HEADER$
#
sources = \
compress_bzip.h \
compress_bzip_component.c \
compress_bzip_module.c
# Make the output library in this directory, and name it either
# mca_<type>_<name>.la (for DSO builds) or libmca_<type>_<name>.la
# (for static builds).
if MCA_BUILD_opal_compress_bzip_DSO
component_noinst =
component_install = mca_compress_bzip.la
else
component_noinst = libmca_compress_bzip.la
component_install =
endif
mcacomponentdir = $(opallibdir)
mcacomponent_LTLIBRARIES = $(component_install)
mca_compress_bzip_la_SOURCES = $(sources)
mca_compress_bzip_la_LDFLAGS = -module -avoid-version
mca_compress_bzip_la_LIBADD = $(top_builddir)/opal/lib@OPAL_LIB_PREFIX@open-pal.la
noinst_LTLIBRARIES = $(component_noinst)
libmca_compress_bzip_la_SOURCES = $(sources)
libmca_compress_bzip_la_LDFLAGS = -module -avoid-version

Просмотреть файл

@ -1,63 +0,0 @@
/*
* Copyright (c) 2004-2010 The Trustees of Indiana University.
* All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
/**
* @file
*
* BZIP COMPRESS component
*
* Uses the bzip library
*/
#ifndef MCA_COMPRESS_BZIP_EXPORT_H
#define MCA_COMPRESS_BZIP_EXPORT_H
#include "opal_config.h"
#include "opal/util/output.h"
#include "opal/mca/mca.h"
#include "opal/mca/compress/compress.h"
#if defined(c_plusplus) || defined(__cplusplus)
extern "C" {
#endif
/*
* Local Component structures
*/
struct opal_compress_bzip_component_t {
opal_compress_base_component_t super; /** Base COMPRESS component */
};
typedef struct opal_compress_bzip_component_t opal_compress_bzip_component_t;
OPAL_MODULE_DECLSPEC extern opal_compress_bzip_component_t mca_compress_bzip_component;
int opal_compress_bzip_component_query(mca_base_module_t **module, int *priority);
/*
* Module functions
*/
int opal_compress_bzip_module_init(void);
int opal_compress_bzip_module_finalize(void);
/*
* Actual funcationality
*/
int opal_compress_bzip_compress(char *fname, char **cname, char **postfix);
int opal_compress_bzip_compress_nb(char *fname, char **cname, char **postfix, pid_t *child_pid);
int opal_compress_bzip_decompress(char *cname, char **fname);
int opal_compress_bzip_decompress_nb(char *cname, char **fname, pid_t *child_pid);
#if defined(c_plusplus) || defined(__cplusplus)
}
#endif
#endif /* MCA_COMPRESS_BZIP_EXPORT_H */

Просмотреть файл

@ -1,167 +0,0 @@
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
/*
* Copyright (c) 2004-2010 The Trustees of Indiana University.
* All rights reserved.
* Copyright (c) 2015 Los Alamos National Security, LLC. All rights
* reserved.
* Copyright (c) 2019 Intel, Inc. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
#include "opal_config.h"
#include "opal/constants.h"
#include "opal/mca/compress/compress.h"
#include "opal/mca/compress/base/base.h"
#include "compress_bzip.h"
/*
* Public string for version number
*/
const char *opal_compress_bzip_component_version_string =
"OPAL COMPRESS bzip MCA component version " OPAL_VERSION;
/*
* Local functionality
*/
static int compress_bzip_register (void);
static int compress_bzip_open(void);
static int compress_bzip_close(void);
/*
* Instantiate the public struct with all of our public information
* and pointer to our public functions in it
*/
opal_compress_bzip_component_t mca_compress_bzip_component = {
/* First do the base component stuff */
{
/* Handle the general mca_component_t struct containing
* meta information about the component itbzip
*/
.base_version = {
OPAL_COMPRESS_BASE_VERSION_2_0_0,
/* Component name and version */
.mca_component_name = "bzip",
MCA_BASE_MAKE_VERSION(component, OPAL_MAJOR_VERSION, OPAL_MINOR_VERSION,
OPAL_RELEASE_VERSION),
/* Component open and close functions */
.mca_open_component = compress_bzip_open,
.mca_close_component = compress_bzip_close,
.mca_query_component = opal_compress_bzip_component_query,
.mca_register_component_params = compress_bzip_register
},
.base_data = {
/* The component is checkpoint ready */
MCA_BASE_METADATA_PARAM_CHECKPOINT
},
.verbose = 0,
.output_handle = -1,
}
};
static bool nocompress(uint8_t *inbytes,
size_t inlen,
uint8_t **outbytes,
size_t *olen)
{
return false;
}
static bool nodecompress(uint8_t **outbytes, size_t olen,
uint8_t *inbytes, size_t len)
{
return false;
}
/*
* Bzip module
*/
static opal_compress_base_module_t loc_module = {
/** Initialization Function */
.init = opal_compress_bzip_module_init,
/** Finalization Function */
.finalize = opal_compress_bzip_module_finalize,
/** Compress Function */
.compress = opal_compress_bzip_compress,
.compress_nb = opal_compress_bzip_compress_nb,
/** Decompress Function */
.decompress = opal_compress_bzip_decompress,
.decompress_nb = opal_compress_bzip_decompress_nb,
.compress_block = nocompress,
.decompress_block = nodecompress
};
static int compress_bzip_register (void)
{
int ret;
mca_compress_bzip_component.super.priority = 10;
ret = mca_base_component_var_register (&mca_compress_bzip_component.super.base_version,
"priority", "Priority of the COMPRESS bzip component "
"(default: 10)", MCA_BASE_VAR_TYPE_INT, NULL, 0,
MCA_BASE_VAR_FLAG_SETTABLE,
OPAL_INFO_LVL_9, MCA_BASE_VAR_SCOPE_ALL_EQ,
&mca_compress_bzip_component.super.priority);
if (0 > ret) {
return ret;
}
ret = mca_base_component_var_register (&mca_compress_bzip_component.super.base_version,
"verbose",
"Verbose level for the COMPRESS bzip component",
MCA_BASE_VAR_TYPE_INT, NULL, 0, MCA_BASE_VAR_FLAG_SETTABLE,
OPAL_INFO_LVL_9, MCA_BASE_VAR_SCOPE_LOCAL,
&mca_compress_bzip_component.super.verbose);
return (0 > ret) ? ret : OPAL_SUCCESS;
}
static int compress_bzip_open(void)
{
/* If there is a custom verbose level for this component than use it
* otherwise take our parents level and output channel
*/
if ( 0 != mca_compress_bzip_component.super.verbose) {
mca_compress_bzip_component.super.output_handle = opal_output_open(NULL);
opal_output_set_verbosity(mca_compress_bzip_component.super.output_handle,
mca_compress_bzip_component.super.verbose);
} else {
mca_compress_bzip_component.super.output_handle = opal_compress_base_framework.framework_output;
}
/*
* Debug output
*/
opal_output_verbose(10, mca_compress_bzip_component.super.output_handle,
"compress:bzip: open()");
opal_output_verbose(20, mca_compress_bzip_component.super.output_handle,
"compress:bzip: open: priority = %d",
mca_compress_bzip_component.super.priority);
opal_output_verbose(20, mca_compress_bzip_component.super.output_handle,
"compress:bzip: open: verbosity = %d",
mca_compress_bzip_component.super.verbose);
return OPAL_SUCCESS;
}
static int compress_bzip_close(void)
{
return OPAL_SUCCESS;
}
int opal_compress_bzip_component_query(mca_base_module_t **module, int *priority)
{
*module = (mca_base_module_t *)&loc_module;
*priority = mca_compress_bzip_component.super.priority;
return OPAL_SUCCESS;
}

Просмотреть файл

@ -1,241 +0,0 @@
/*
* Copyright (c) 2004-2010 The Trustees of Indiana University.
* All rights reserved.
* Copyright (c) 2010 Oracle and/or its affiliates. All rights reserved.
*
* Copyright (c) 2014 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2015 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
* Copyright (c) 2018 Amazon.com, Inc. or its affiliates. All Rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
#include "opal_config.h"
#include <string.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <sys/stat.h>
#if HAVE_UNISTD_H
#include <unistd.h>
#endif /* HAVE_UNISTD_H */
#include "opal/util/opal_environ.h"
#include "opal/util/output.h"
#include "opal/util/argv.h"
#include "opal/util/opal_environ.h"
#include "opal/util/printf.h"
#include "opal/constants.h"
#include "opal/util/basename.h"
#include "opal/mca/compress/compress.h"
#include "opal/mca/compress/base/base.h"
#include "opal/runtime/opal_cr.h"
#include "compress_bzip.h"
static bool is_directory(char *fname );
int opal_compress_bzip_module_init(void)
{
return OPAL_SUCCESS;
}
int opal_compress_bzip_module_finalize(void)
{
return OPAL_SUCCESS;
}
int opal_compress_bzip_compress(char * fname, char **cname, char **postfix)
{
pid_t child_pid = 0;
int status = 0;
opal_output_verbose(10, mca_compress_bzip_component.super.output_handle,
"compress:bzip: compress(%s)",
fname);
opal_compress_bzip_compress_nb(fname, cname, postfix, &child_pid);
waitpid(child_pid, &status, 0);
if( WIFEXITED(status) ) {
return OPAL_SUCCESS;
} else {
return OPAL_ERROR;
}
}
int opal_compress_bzip_compress_nb(char * fname, char **cname, char **postfix, pid_t *child_pid)
{
char **argv = NULL;
char * base_fname = NULL;
char * dir_fname = NULL;
int status;
bool is_dir;
is_dir = is_directory(fname);
*child_pid = fork();
if( *child_pid == 0 ) { /* Child */
char * cmd;
dir_fname = opal_dirname(fname);
base_fname = opal_basename(fname);
chdir(dir_fname);
if( is_dir ) {
#if 0
opal_compress_base_tar_create(&base_fname);
opal_asprintf(cname, "%s.bz2", base_fname);
opal_asprintf(&cmd, "bzip2 %s", base_fname);
#else
opal_asprintf(cname, "%s.tar.bz2", base_fname);
opal_asprintf(&cmd, "tar -jcf %s %s", *cname, base_fname);
#endif
} else {
opal_asprintf(cname, "%s.bz2", base_fname);
opal_asprintf(&cmd, "bzip2 %s", base_fname);
}
opal_output_verbose(10, mca_compress_bzip_component.super.output_handle,
"compress:bzip: compress_nb(%s -> [%s])",
fname, *cname);
opal_output_verbose(10, mca_compress_bzip_component.super.output_handle,
"compress:bzip: compress_nb() command [%s]",
cmd);
argv = opal_argv_split(cmd, ' ');
status = execvp(argv[0], argv);
opal_output(0, "compress:bzip: compress_nb: Failed to exec child [%s] status = %d\n", cmd, status);
exit(OPAL_ERROR);
}
else if( *child_pid > 0 ) {
if( is_dir ) {
*postfix = strdup(".tar.bz2");
} else {
*postfix = strdup(".bz2");
}
opal_asprintf(cname, "%s%s", fname, *postfix);
}
else {
return OPAL_ERROR;
}
return OPAL_SUCCESS;
}
int opal_compress_bzip_decompress(char * cname, char **fname)
{
pid_t child_pid = 0;
int status = 0;
opal_output_verbose(10, mca_compress_bzip_component.super.output_handle,
"compress:bzip: decompress(%s)",
cname);
opal_compress_bzip_decompress_nb(cname, fname, &child_pid);
waitpid(child_pid, &status, 0);
if( WIFEXITED(status) ) {
return OPAL_SUCCESS;
} else {
return OPAL_ERROR;
}
}
int opal_compress_bzip_decompress_nb(char * cname, char **fname, pid_t *child_pid)
{
char **argv = NULL;
char * dir_cname = NULL;
pid_t loc_pid = 0;
int status;
bool is_tar = false;
if( 0 == strncmp(&(cname[strlen(cname)-8]), ".tar.bz2", strlen(".tar.bz2")) ) {
is_tar = true;
}
*fname = strdup(cname);
if( is_tar ) {
(*fname)[strlen(cname)-8] = '\0';
} else {
(*fname)[strlen(cname)-4] = '\0';
}
opal_output_verbose(10, mca_compress_bzip_component.super.output_handle,
"compress:bzip: decompress_nb(%s -> [%s])",
cname, *fname);
*child_pid = fork();
if( *child_pid == 0 ) { /* Child */
dir_cname = opal_dirname(cname);
chdir(dir_cname);
/* Fork(bunzip) */
loc_pid = fork();
if( loc_pid == 0 ) { /* Child */
char * cmd;
opal_asprintf(&cmd, "bunzip2 %s", cname);
opal_output_verbose(10, mca_compress_bzip_component.super.output_handle,
"compress:bzip: decompress_nb() command [%s]",
cmd);
argv = opal_argv_split(cmd, ' ');
status = execvp(argv[0], argv);
opal_output(0, "compress:bzip: decompress_nb: Failed to exec child [%s] status = %d\n", cmd, status);
exit(OPAL_ERROR);
}
else if( loc_pid > 0 ) { /* Parent */
waitpid(loc_pid, &status, 0);
if( !WIFEXITED(status) ) {
opal_output(0, "compress:bzip: decompress_nb: Failed to bunzip the file [%s] status = %d\n", cname, status);
exit(OPAL_ERROR);
}
}
else {
exit(OPAL_ERROR);
}
/* tar_decompress */
if( is_tar ) {
/* Strip off '.bz2' leaving just '.tar' */
cname[strlen(cname)-4] = '\0';
opal_compress_base_tar_extract(&cname);
}
/* Once this child is done, then directly exit */
exit(OPAL_SUCCESS);
}
else if( *child_pid > 0 ) {
;
}
else {
return OPAL_ERROR;
}
return OPAL_SUCCESS;
}
static bool is_directory(char *fname ) {
struct stat file_status;
int rc;
if(0 != (rc = stat(fname, &file_status) ) ) {
return false;
}
if(S_ISDIR(file_status.st_mode)) {
return true;
}
return false;
}

Просмотреть файл

@ -1,7 +0,0 @@
#
# owner/status file
# owner: institution that is responsible for this package
# status: e.g. active, maintenance, unmaintained
#
owner:project
status:maintenance

Просмотреть файл

@ -1,156 +0,0 @@
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
/*
* Copyright (c) 2004-2010 The Trustees of Indiana University and Indiana
* University Research and Technology
* Corporation. All rights reserved.
* Copyright (c) 2015 Los Alamos National Security, LLC. All rights
* reserved.
*
* Copyright (c) 2019 Intel, Inc. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
/**
* @file
*
* Compression Framework
*
* General Description:
*
* The OPAL Compress framework has been created to provide an abstract interface
* to the compression agent library on the host machine. This fromework is useful
* when distributing files that can be compressed before sending to dimish the
* load on the network.
*
*/
#ifndef MCA_COMPRESS_H
#define MCA_COMPRESS_H
#include "opal_config.h"
#include "opal/mca/mca.h"
#include "opal/mca/base/base.h"
#include "opal/class/opal_object.h"
#if defined(c_plusplus) || defined(__cplusplus)
extern "C" {
#endif
/**
* Module initialization function.
* Returns OPAL_SUCCESS
*/
typedef int (*opal_compress_base_module_init_fn_t)
(void);
/**
* Module finalization function.
* Returns OPAL_SUCCESS
*/
typedef int (*opal_compress_base_module_finalize_fn_t)
(void);
/**
* Compress the file provided
*
* Arguments:
* fname = Filename to compress
* cname = Compressed filename
* postfix = postfix added to filename to create compressed filename
* Returns:
* OPAL_SUCCESS on success, ow OPAL_ERROR
*/
typedef int (*opal_compress_base_module_compress_fn_t)
(char * fname, char **cname, char **postfix);
typedef int (*opal_compress_base_module_compress_nb_fn_t)
(char * fname, char **cname, char **postfix, pid_t *child_pid);
/**
* Decompress the file provided
*
* Arguments:
* fname = Filename to compress
* cname = Compressed filename
* Returns:
* OPAL_SUCCESS on success, ow OPAL_ERROR
*/
typedef int (*opal_compress_base_module_decompress_fn_t)
(char * cname, char **fname);
typedef int (*opal_compress_base_module_decompress_nb_fn_t)
(char * cname, char **fname, pid_t *child_pid);
/**
* Compress a string
*
* Arguments:
*
*/
typedef bool (*opal_compress_base_module_compress_string_fn_t)(uint8_t *inbytes,
size_t inlen,
uint8_t **outbytes,
size_t *olen);
typedef bool (*opal_compress_base_module_decompress_string_fn_t)(uint8_t **outbytes, size_t olen,
uint8_t *inbytes, size_t len);
/**
* Structure for COMPRESS components.
*/
struct opal_compress_base_component_2_0_0_t {
/** MCA base component */
mca_base_component_t base_version;
/** MCA base data */
mca_base_component_data_t base_data;
/** Verbosity Level */
int verbose;
/** Output Handle for opal_output */
int output_handle;
/** Default Priority */
int priority;
};
typedef struct opal_compress_base_component_2_0_0_t opal_compress_base_component_2_0_0_t;
typedef struct opal_compress_base_component_2_0_0_t opal_compress_base_component_t;
/**
* Structure for COMPRESS modules
*/
struct opal_compress_base_module_1_0_0_t {
/** Initialization Function */
opal_compress_base_module_init_fn_t init;
/** Finalization Function */
opal_compress_base_module_finalize_fn_t finalize;
/** Compress interface */
opal_compress_base_module_compress_fn_t compress;
opal_compress_base_module_compress_nb_fn_t compress_nb;
/** Decompress Interface */
opal_compress_base_module_decompress_fn_t decompress;
opal_compress_base_module_decompress_nb_fn_t decompress_nb;
/* COMPRESS STRING */
opal_compress_base_module_compress_string_fn_t compress_block;
opal_compress_base_module_decompress_string_fn_t decompress_block;
};
typedef struct opal_compress_base_module_1_0_0_t opal_compress_base_module_1_0_0_t;
typedef struct opal_compress_base_module_1_0_0_t opal_compress_base_module_t;
OPAL_DECLSPEC extern opal_compress_base_module_t opal_compress;
/**
* Macro for use in components that are of type COMPRESS
*/
#define OPAL_COMPRESS_BASE_VERSION_2_0_0 \
OPAL_MCA_BASE_VERSION_2_1_0("compress", 2, 0, 0)
#if defined(c_plusplus) || defined(__cplusplus)
}
#endif
#endif /* OPAL_COMPRESS_H */

Просмотреть файл

Просмотреть файл

@ -1,36 +0,0 @@
#
# Copyright (c) 2016-2019 Intel, Inc. All rights reserved.
# Copyright (c) 2017 IBM Corporation. All rights reserved.
# $COPYRIGHT$
#
# Additional copyrights may follow
#
# $HEADER$
#
sources = \
regx_fwd_component.c \
regx_fwd.h \
regx_fwd.c
# Make the output library in this directory, and name it either
# mca_<type>_<name>.la (for DSO builds) or libmca_<type>_<name>.la
# (for static builds).
if MCA_BUILD_orte_regx_fwd_DSO
component_noinst =
component_install = mca_regx_fwd.la
else
component_noinst = libmca_regx_fwd.la
component_install =
endif
mcacomponentdir = $(ortelibdir)
mcacomponent_LTLIBRARIES = $(component_install)
mca_regx_fwd_la_SOURCES = $(sources)
mca_regx_fwd_la_LDFLAGS = -module -avoid-version
mca_regx_fwd_la_LIBADD = $(top_builddir)/orte/lib@ORTE_LIB_PREFIX@open-rte.la
noinst_LTLIBRARIES = $(component_noinst)
libmca_regx_fwd_la_SOURCES = $(sources)
libmca_regx_fwd_la_LDFLAGS = -module -avoid-version

Просмотреть файл

@ -1,7 +0,0 @@
#
# owner/status file
# owner: institution that is responsible for this package
# status: e.g. active, maintenance, unmaintained
#
owner: INTEL
status: active

Просмотреть файл

@ -1,300 +0,0 @@
/*
* Copyright (c) 2016-2019 Intel, Inc. All rights reserved.
* Copyright (c) 2018 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*
*/
#include "orte_config.h"
#include "orte/types.h"
#include "opal/types.h"
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <ctype.h>
#include "opal/util/argv.h"
#include "opal/util/basename.h"
#include "opal/util/opal_environ.h"
#include "orte/runtime/orte_globals.h"
#include "orte/util/name_fns.h"
#include "orte/util/show_help.h"
#include "orte/mca/errmgr/errmgr.h"
#include "orte/mca/rmaps/base/base.h"
#include "orte/mca/routed/routed.h"
#include "orte/mca/regx/base/base.h"
#include "regx_fwd.h"
static int nidmap_create(opal_pointer_array_t *pool, char **regex);
orte_regx_base_module_t orte_regx_fwd_module = {
.nidmap_create = nidmap_create,
.nidmap_parse = orte_regx_base_nidmap_parse,
.extract_node_names = orte_regx_base_extract_node_names,
.encode_nodemap = orte_regx_base_encode_nodemap,
.decode_daemon_nodemap = orte_regx_base_decode_daemon_nodemap,
.generate_ppn = orte_regx_base_generate_ppn,
.parse_ppn = orte_regx_base_parse_ppn
};
static int nidmap_create(opal_pointer_array_t *pool, char **regex)
{
char *node;
char prefix[ORTE_MAX_NODE_PREFIX];
int i, j, n, len, startnum, nodenum, numdigits;
bool found;
char *suffix, *sfx, *nodenames;
orte_regex_node_t *ndreg;
orte_regex_range_t *range, *rng;
opal_list_t nodenms, dvpids;
opal_list_item_t *item, *itm2;
char **regexargs = NULL, *tmp, *tmp2;
orte_node_t *nptr;
orte_vpid_t vpid;
OBJ_CONSTRUCT(&nodenms, opal_list_t);
OBJ_CONSTRUCT(&dvpids, opal_list_t);
rng = NULL;
for (n=0; n < pool->size; n++) {
if (NULL == (nptr = (orte_node_t*)opal_pointer_array_get_item(pool, n))) {
continue;
}
/* if no daemon has been assigned, then this node is not being used */
if (NULL == nptr->daemon) {
vpid = -1; // indicates no daemon assigned
} else {
vpid = nptr->daemon->name.vpid;
}
/* deal with the daemon vpid - see if it is next in the
* current range */
if (NULL == rng) {
/* just starting */
rng = OBJ_NEW(orte_regex_range_t);
rng->vpid = vpid;
rng->cnt = 1;
opal_list_append(&dvpids, &rng->super);
} else if (UINT32_MAX == vpid) {
if (-1 == rng->vpid) {
rng->cnt++;
} else {
/* need to start another range */
rng = OBJ_NEW(orte_regex_range_t);
rng->vpid = vpid;
rng->cnt = 1;
opal_list_append(&dvpids, &rng->super);
}
} else if (-1 == rng->vpid) {
/* need to start another range */
rng = OBJ_NEW(orte_regex_range_t);
rng->vpid = vpid;
rng->cnt = 1;
opal_list_append(&dvpids, &rng->super);
} else {
/* is this the next in line */
if (vpid == (orte_vpid_t)(rng->vpid + rng->cnt)) {
rng->cnt++;
} else {
/* need to start another range */
rng = OBJ_NEW(orte_regex_range_t);
rng->vpid = vpid;
rng->cnt = 1;
opal_list_append(&dvpids, &rng->super);
}
}
node = nptr->name;
/* determine this node's prefix by looking for first digit char */
len = strlen(node);
startnum = -1;
memset(prefix, 0, ORTE_MAX_NODE_PREFIX);
for (i=0, j=0; i < len; i++) {
/* valid hostname characters are ascii letters, digits and the '-' character. */
if (isdigit(node[i])) {
/* count the size of the numeric field - but don't
* add the digits to the prefix
*/
if (startnum < 0) {
/* okay, this defines end of the prefix */
startnum = i;
}
continue;
}
/* this must be either an alpha, a '.', or '-' */
if (!isalpha(node[i]) && '-' != node[i] && '.' != node[i]) {
orte_show_help("help-regex.txt", "regex:invalid-name", true, node);
return ORTE_ERR_SILENT;
}
if (startnum < 0) {
prefix[j++] = node[i];
}
}
if (startnum < 0) {
/* can't compress this name - just add it to the list */
ndreg = OBJ_NEW(orte_regex_node_t);
ndreg->prefix = strdup(node);
opal_list_append(&nodenms, &ndreg->super);
continue;
}
/* convert the digits and get any suffix */
nodenum = strtol(&node[startnum], &sfx, 10);
if (NULL != sfx) {
suffix = strdup(sfx);
numdigits = (int)(sfx - &node[startnum]);
} else {
suffix = NULL;
numdigits = (int)strlen(&node[startnum]);
}
/* is this node name already on our list? */
found = false;
if (0 != opal_list_get_size(&nodenms)) {
ndreg = (orte_regex_node_t*)opal_list_get_last(&nodenms);
if ((0 < strlen(prefix) && NULL == ndreg->prefix) ||
(0 == strlen(prefix) && NULL != ndreg->prefix) ||
(0 < strlen(prefix) && NULL != ndreg->prefix &&
0 != strcmp(prefix, ndreg->prefix)) ||
(NULL == suffix && NULL != ndreg->suffix) ||
(NULL != suffix && NULL == ndreg->suffix) ||
(NULL != suffix && NULL != ndreg->suffix &&
0 != strcmp(suffix, ndreg->suffix)) ||
(numdigits != ndreg->num_digits)) {
found = false;
} else {
/* found a match - flag it */
found = true;
}
}
if (found) {
range = (orte_regex_range_t*)opal_list_get_last(&ndreg->ranges);
if (NULL == range) {
/* first range for this nodeid */
range = OBJ_NEW(orte_regex_range_t);
range->vpid = nodenum;
range->cnt = 1;
opal_list_append(&ndreg->ranges, &range->super);
/* see if the node number is out of sequence */
} else if (nodenum != (range->vpid + range->cnt)) {
/* start a new range */
range = OBJ_NEW(orte_regex_range_t);
range->vpid = nodenum;
range->cnt = 1;
opal_list_append(&ndreg->ranges, &range->super);
} else {
/* everything matches - just increment the cnt */
range->cnt++;
}
} else {
/* need to add it */
ndreg = OBJ_NEW(orte_regex_node_t);
if (0 < strlen(prefix)) {
ndreg->prefix = strdup(prefix);
}
if (NULL != suffix) {
ndreg->suffix = strdup(suffix);
}
ndreg->num_digits = numdigits;
opal_list_append(&nodenms, &ndreg->super);
/* record the first range for this nodeid - we took
* care of names we can't compress above
*/
range = OBJ_NEW(orte_regex_range_t);
range->vpid = nodenum;
range->cnt = 1;
opal_list_append(&ndreg->ranges, &range->super);
}
if (NULL != suffix) {
free(suffix);
}
}
/* begin constructing the regular expression */
while (NULL != (item = opal_list_remove_first(&nodenms))) {
ndreg = (orte_regex_node_t*)item;
/* if no ranges, then just add the name */
if (0 == opal_list_get_size(&ndreg->ranges)) {
if (NULL != ndreg->prefix) {
/* solitary node */
opal_asprintf(&tmp, "%s", ndreg->prefix);
opal_argv_append_nosize(&regexargs, tmp);
free(tmp);
}
OBJ_RELEASE(ndreg);
continue;
}
/* start the regex for this nodeid with the prefix */
if (NULL != ndreg->prefix) {
opal_asprintf(&tmp, "%s[%d:", ndreg->prefix, ndreg->num_digits);
} else {
opal_asprintf(&tmp, "[%d:", ndreg->num_digits);
}
/* add the ranges */
while (NULL != (itm2 = opal_list_remove_first(&ndreg->ranges))) {
range = (orte_regex_range_t*)itm2;
if (1 == range->cnt) {
opal_asprintf(&tmp2, "%s%u,", tmp, range->vpid);
} else {
opal_asprintf(&tmp2, "%s%u-%u,", tmp, range->vpid, range->vpid + range->cnt - 1);
}
free(tmp);
tmp = tmp2;
OBJ_RELEASE(range);
}
/* replace the final comma */
tmp[strlen(tmp)-1] = ']';
if (NULL != ndreg->suffix) {
/* add in the suffix, if provided */
opal_asprintf(&tmp2, "%s%s", tmp, ndreg->suffix);
free(tmp);
tmp = tmp2;
}
opal_argv_append_nosize(&regexargs, tmp);
free(tmp);
OBJ_RELEASE(ndreg);
}
/* assemble final result */
nodenames = opal_argv_join(regexargs, ',');
/* cleanup */
opal_argv_free(regexargs);
OBJ_DESTRUCT(&nodenms);
/* do the same for the vpids */
tmp = NULL;
while (NULL != (item = opal_list_remove_first(&dvpids))) {
rng = (orte_regex_range_t*)item;
if (1 < rng->cnt) {
if (NULL == tmp) {
opal_asprintf(&tmp, "%u(%u)", rng->vpid, rng->cnt);
} else {
opal_asprintf(&tmp2, "%s,%u(%u)", tmp, rng->vpid, rng->cnt);
free(tmp);
tmp = tmp2;
}
} else {
if (NULL == tmp) {
opal_asprintf(&tmp, "%u", rng->vpid);
} else {
opal_asprintf(&tmp2, "%s,%u", tmp, rng->vpid);
free(tmp);
tmp = tmp2;
}
}
OBJ_RELEASE(rng);
}
OPAL_LIST_DESTRUCT(&dvpids);
/* now concatenate the results into one string */
opal_asprintf(&tmp2, "%s@%s", nodenames, tmp);
free(nodenames);
free(tmp);
*regex = tmp2;
return ORTE_SUCCESS;
}

Просмотреть файл

@ -1,28 +0,0 @@
/*
* Copyright (c) 2016-2019 Intel, Inc. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
#ifndef _MCA_REGX_FwD_H_
#define _MCA_REGX_FwD_H_
#include "orte_config.h"
#include "orte/types.h"
#include "opal/mca/base/base.h"
#include "orte/mca/regx/regx.h"
BEGIN_C_DECLS
ORTE_MODULE_DECLSPEC extern orte_regx_base_component_t mca_regx_fwd_component;
extern orte_regx_base_module_t orte_regx_fwd_module;
END_C_DECLS
#endif /* MCA_REGX_FwD_H_ */

Просмотреть файл

@ -1,44 +0,0 @@
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
/*
* Copyright (c) 2016-2019 Intel, Inc. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
#include "orte_config.h"
#include "orte/types.h"
#include "opal/types.h"
#include "opal/util/show_help.h"
#include "orte/mca/regx/regx.h"
#include "regx_fwd.h"
static int component_query(mca_base_module_t **module, int *priority);
/*
* Struct of function pointers and all that to let us be initialized
*/
orte_regx_base_component_t mca_regx_fwd_component = {
.base_version = {
MCA_REGX_BASE_VERSION_1_0_0,
.mca_component_name = "fwd",
MCA_BASE_MAKE_VERSION(component, ORTE_MAJOR_VERSION, ORTE_MINOR_VERSION,
ORTE_RELEASE_VERSION),
.mca_query_component = component_query,
},
.base_data = {
/* The component is checkpoint ready */
MCA_BASE_METADATA_PARAM_CHECKPOINT
},
};
static int component_query(mca_base_module_t **module, int *priority)
{
*module = (mca_base_module_t*)&orte_regx_fwd_module;
*priority = 10;
return ORTE_SUCCESS;
}

Просмотреть файл

Просмотреть файл

@ -1,38 +0,0 @@
#
# Copyright (c) 2004-2010 The Trustees of Indiana University.
# All rights reserved.
# Copyright (c) 2014-2015 Cisco Systems, Inc. All rights reserved.
# Copyright (c) 2017 IBM Corporation. All rights reserved.
# $COPYRIGHT$
#
# Additional copyrights may follow
#
# $HEADER$
#
sources = \
compress_gzip.h \
compress_gzip_component.c \
compress_gzip_module.c
# Make the output library in this directory, and name it either
# mca_<type>_<name>.la (for DSO builds) or libmca_<type>_<name>.la
# (for static builds).
if MCA_BUILD_opal_compress_gzip_DSO
component_noinst =
component_install = mca_compress_gzip.la
else
component_noinst = libmca_compress_gzip.la
component_install =
endif
mcacomponentdir = $(opallibdir)
mcacomponent_LTLIBRARIES = $(component_install)
mca_compress_gzip_la_SOURCES = $(sources)
mca_compress_gzip_la_LDFLAGS = -module -avoid-version
mca_compress_gzip_la_LIBADD = $(top_builddir)/opal/lib@OPAL_LIB_PREFIX@open-pal.la
noinst_LTLIBRARIES = $(component_noinst)
libmca_compress_gzip_la_SOURCES = $(sources)
libmca_compress_gzip_la_LDFLAGS = -module -avoid-version

Просмотреть файл

@ -1,63 +0,0 @@
/*
* Copyright (c) 2004-2010 The Trustees of Indiana University.
* All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
/**
* @file
*
* GZIP COMPRESS component
*
* Uses the gzip library
*/
#ifndef MCA_COMPRESS_GZIP_EXPORT_H
#define MCA_COMPRESS_GZIP_EXPORT_H
#include "opal_config.h"
#include "opal/util/output.h"
#include "opal/mca/mca.h"
#include "opal/mca/compress/compress.h"
#if defined(c_plusplus) || defined(__cplusplus)
extern "C" {
#endif
/*
* Local Component structures
*/
struct opal_compress_gzip_component_t {
opal_compress_base_component_t super; /** Base COMPRESS component */
};
typedef struct opal_compress_gzip_component_t opal_compress_gzip_component_t;
OPAL_MODULE_DECLSPEC extern opal_compress_gzip_component_t mca_compress_gzip_component;
int opal_compress_gzip_component_query(mca_base_module_t **module, int *priority);
/*
* Module functions
*/
int opal_compress_gzip_module_init(void);
int opal_compress_gzip_module_finalize(void);
/*
* Actual funcationality
*/
int opal_compress_gzip_compress(char *fname, char **cname, char **postfix);
int opal_compress_gzip_compress_nb(char *fname, char **cname, char **postfix, pid_t *child_pid);
int opal_compress_gzip_decompress(char *cname, char **fname);
int opal_compress_gzip_decompress_nb(char *cname, char **fname, pid_t *child_pid);
#if defined(c_plusplus) || defined(__cplusplus)
}
#endif
#endif /* MCA_COMPRESS_GZIP_EXPORT_H */

Просмотреть файл

@ -1,168 +0,0 @@
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
/*
* Copyright (c) 2004-2010 The Trustees of Indiana University.
* All rights reserved.
* Copyright (c) 2015 Los Alamos National Security, LLC. All rights
* reserved.
* Copyright (c) 2019 Intel, Inc. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
#include "opal_config.h"
#include "opal/constants.h"
#include "opal/mca/compress/compress.h"
#include "opal/mca/compress/base/base.h"
#include "compress_gzip.h"
/*
* Public string for version number
*/
const char *opal_compress_gzip_component_version_string =
"OPAL COMPRESS gzip MCA component version " OPAL_VERSION;
/*
* Local functionality
*/
static int compress_gzip_register (void);
static int compress_gzip_open(void);
static int compress_gzip_close(void);
/*
* Instantiate the public struct with all of our public information
* and pointer to our public functions in it
*/
opal_compress_gzip_component_t mca_compress_gzip_component = {
/* First do the base component stuff */
{
/* Handle the general mca_component_t struct containing
* meta information about the component itgzip
*/
.base_version = {
OPAL_COMPRESS_BASE_VERSION_2_0_0,
/* Component name and version */
.mca_component_name = "gzip",
MCA_BASE_MAKE_VERSION(component, OPAL_MAJOR_VERSION, OPAL_MINOR_VERSION,
OPAL_RELEASE_VERSION),
/* Component open and close functions */
.mca_open_component = compress_gzip_open,
.mca_close_component = compress_gzip_close,
.mca_query_component = opal_compress_gzip_component_query,
.mca_register_component_params = compress_gzip_register
},
.base_data = {
/* The component is checkpoint ready */
MCA_BASE_METADATA_PARAM_CHECKPOINT
},
.verbose = 0,
.output_handle = -1,
}
};
static bool nocompress(uint8_t *inbytes,
size_t inlen,
uint8_t **outbytes,
size_t *olen)
{
return false;
}
static bool nodecompress(uint8_t **outbytes, size_t olen,
uint8_t *inbytes, size_t len)
{
return false;
}
/*
* Gzip module
*/
static opal_compress_base_module_t loc_module = {
/** Initialization Function */
.init = opal_compress_gzip_module_init,
/** Finalization Function */
.finalize = opal_compress_gzip_module_finalize,
/** Compress Function */
.compress = opal_compress_gzip_compress,
.compress_nb = opal_compress_gzip_compress_nb,
/** Decompress Function */
.decompress = opal_compress_gzip_decompress,
.decompress_nb = opal_compress_gzip_decompress_nb,
.compress_block = nocompress,
.decompress_block = nodecompress
};
static int compress_gzip_register (void)
{
int ret;
mca_compress_gzip_component.super.priority = 15;
ret = mca_base_component_var_register (&mca_compress_gzip_component.super.base_version,
"priority", "Priority of the COMPRESS gzip component "
"(default: 15)", MCA_BASE_VAR_TYPE_INT, NULL, 0,
MCA_BASE_VAR_FLAG_SETTABLE,
OPAL_INFO_LVL_9, MCA_BASE_VAR_SCOPE_ALL_EQ,
&mca_compress_gzip_component.super.priority);
if (0 > ret) {
return ret;
}
mca_compress_gzip_component.super.verbose = 0;
ret = mca_base_component_var_register (&mca_compress_gzip_component.super.base_version,
"verbose",
"Verbose level for the COMPRESS gzip component",
MCA_BASE_VAR_TYPE_INT, NULL, 0, MCA_BASE_VAR_FLAG_SETTABLE,
OPAL_INFO_LVL_9, MCA_BASE_VAR_SCOPE_LOCAL,
&mca_compress_gzip_component.super.verbose);
return (0 > ret) ? ret : OPAL_SUCCESS;
}
static int compress_gzip_open(void)
{
/* If there is a custom verbose level for this component than use it
* otherwise take our parents level and output channel
*/
if ( 0 != mca_compress_gzip_component.super.verbose) {
mca_compress_gzip_component.super.output_handle = opal_output_open(NULL);
opal_output_set_verbosity(mca_compress_gzip_component.super.output_handle,
mca_compress_gzip_component.super.verbose);
} else {
mca_compress_gzip_component.super.output_handle = opal_compress_base_framework.framework_output;
}
/*
* Debug output
*/
opal_output_verbose(10, mca_compress_gzip_component.super.output_handle,
"compress:gzip: open()");
opal_output_verbose(20, mca_compress_gzip_component.super.output_handle,
"compress:gzip: open: priority = %d",
mca_compress_gzip_component.super.priority);
opal_output_verbose(20, mca_compress_gzip_component.super.output_handle,
"compress:gzip: open: verbosity = %d",
mca_compress_gzip_component.super.verbose);
return OPAL_SUCCESS;
}
static int compress_gzip_close(void)
{
return OPAL_SUCCESS;
}
int opal_compress_gzip_component_query(mca_base_module_t **module, int *priority)
{
*module = (mca_base_module_t *)&loc_module;
*priority = mca_compress_gzip_component.super.priority;
return OPAL_SUCCESS;
}

Просмотреть файл

@ -1,244 +0,0 @@
/*
* Copyright (c) 2004-2010 The Trustees of Indiana University.
* All rights reserved.
* Copyright (c) 2010 Oracle and/or its affiliates. All rights reserved.
*
* Copyright (c) 2014 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2015 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
* Copyright (c) 2018 Amazon.com, Inc. or its affiliates. All Rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
#include "opal_config.h"
#include <string.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <sys/stat.h>
#if HAVE_UNISTD_H
#include <unistd.h>
#endif /* HAVE_UNISTD_H */
#include "opal/util/opal_environ.h"
#include "opal/util/output.h"
#include "opal/util/argv.h"
#include "opal/util/opal_environ.h"
#include "opal/util/printf.h"
#include "opal/constants.h"
#include "opal/util/basename.h"
#include "opal/mca/compress/compress.h"
#include "opal/mca/compress/base/base.h"
#include "opal/runtime/opal_cr.h"
#include "compress_gzip.h"
static bool is_directory(char *fname );
int opal_compress_gzip_module_init(void)
{
return OPAL_SUCCESS;
}
int opal_compress_gzip_module_finalize(void)
{
return OPAL_SUCCESS;
}
int opal_compress_gzip_compress(char * fname, char **cname, char **postfix)
{
pid_t child_pid = 0;
int status = 0;
opal_output_verbose(10, mca_compress_gzip_component.super.output_handle,
"compress:gzip: compress(%s)",
fname);
opal_compress_gzip_compress_nb(fname, cname, postfix, &child_pid);
waitpid(child_pid, &status, 0);
if( WIFEXITED(status) ) {
return OPAL_SUCCESS;
} else {
return OPAL_ERROR;
}
}
int opal_compress_gzip_compress_nb(char * fname, char **cname, char **postfix, pid_t *child_pid)
{
char **argv = NULL;
char * base_fname = NULL;
char * dir_fname = NULL;
int status;
bool is_dir;
is_dir = is_directory(fname);
*child_pid = fork();
if( *child_pid == 0 ) { /* Child */
char * cmd = NULL;
dir_fname = opal_dirname(fname);
base_fname = opal_basename(fname);
chdir(dir_fname);
if( is_dir ) {
#if 0
opal_compress_base_tar_create(&base_fname);
opal_asprintf(cname, "%s.gz", base_fname);
opal_asprintf(&cmd, "gzip %s", base_fname);
#else
opal_asprintf(cname, "%s.tar.gz", base_fname);
opal_asprintf(&cmd, "tar -zcf %s %s", *cname, base_fname);
#endif
} else {
opal_asprintf(cname, "%s.gz", base_fname);
opal_asprintf(&cmd, "gzip %s", base_fname);
}
opal_output_verbose(10, mca_compress_gzip_component.super.output_handle,
"compress:gzip: compress_nb(%s -> [%s])",
fname, *cname);
opal_output_verbose(10, mca_compress_gzip_component.super.output_handle,
"compress:gzip: compress_nb() command [%s]",
cmd);
argv = opal_argv_split(cmd, ' ');
status = execvp(argv[0], argv);
opal_output(0, "compress:gzip: compress_nb: Failed to exec child [%s] status = %d\n", cmd, status);
exit(OPAL_ERROR);
}
else if( *child_pid > 0 ) {
if( is_dir ) {
*postfix = strdup(".tar.gz");
} else {
*postfix = strdup(".gz");
}
opal_asprintf(cname, "%s%s", fname, *postfix);
}
else {
return OPAL_ERROR;
}
return OPAL_SUCCESS;
}
int opal_compress_gzip_decompress(char * cname, char **fname)
{
pid_t child_pid = 0;
int status = 0;
opal_output_verbose(10, mca_compress_gzip_component.super.output_handle,
"compress:gzip: decompress(%s)",
cname);
opal_compress_gzip_decompress_nb(cname, fname, &child_pid);
waitpid(child_pid, &status, 0);
if( WIFEXITED(status) ) {
return OPAL_SUCCESS;
} else {
return OPAL_ERROR;
}
}
int opal_compress_gzip_decompress_nb(char * cname, char **fname, pid_t *child_pid)
{
char **argv = NULL;
char * dir_cname = NULL;
pid_t loc_pid = 0;
int status;
bool is_tar = false;
if( 0 == strncmp(&(cname[strlen(cname)-7]), ".tar.gz", strlen(".tar.gz")) ) {
is_tar = true;
}
*fname = strdup(cname);
if( is_tar ) {
/* Strip off '.tar.gz' */
(*fname)[strlen(cname)-7] = '\0';
} else {
/* Strip off '.gz' */
(*fname)[strlen(cname)-3] = '\0';
}
opal_output_verbose(10, mca_compress_gzip_component.super.output_handle,
"compress:gzip: decompress_nb(%s -> [%s])",
cname, *fname);
*child_pid = fork();
if( *child_pid == 0 ) { /* Child */
char * cmd;
dir_cname = opal_dirname(cname);
chdir(dir_cname);
/* Fork(gunzip) */
loc_pid = fork();
if( loc_pid == 0 ) { /* Child */
opal_asprintf(&cmd, "gunzip %s", cname);
opal_output_verbose(10, mca_compress_gzip_component.super.output_handle,
"compress:gzip: decompress_nb() command [%s]",
cmd);
argv = opal_argv_split(cmd, ' ');
status = execvp(argv[0], argv);
opal_output(0, "compress:gzip: decompress_nb: Failed to exec child [%s] status = %d\n", cmd, status);
exit(OPAL_ERROR);
}
else if( loc_pid > 0 ) { /* Parent */
waitpid(loc_pid, &status, 0);
if( !WIFEXITED(status) ) {
opal_output(0, "compress:gzip: decompress_nb: Failed to bunzip the file [%s] status = %d\n", cname, status);
exit(OPAL_ERROR);
}
}
else {
exit(OPAL_ERROR);
}
/* tar_decompress */
if( is_tar ) {
/* Strip off '.gz' leaving just '.tar' */
cname[strlen(cname)-3] = '\0';
opal_compress_base_tar_extract(&cname);
}
/* Once this child is done, then directly exit */
exit(OPAL_SUCCESS);
}
else if( *child_pid > 0 ) {
;
}
else {
return OPAL_ERROR;
}
return OPAL_SUCCESS;
}
static bool is_directory(char *fname ) {
struct stat file_status;
int rc;
if(0 != (rc = stat(fname, &file_status) ) ) {
return false;
}
if(S_ISDIR(file_status.st_mode)) {
return true;
}
return false;
}

Просмотреть файл

@ -1,7 +0,0 @@
#
# owner/status file
# owner: institution that is responsible for this package
# status: e.g. active, maintenance, unmaintained
#
owner:project
status:maintenance

Просмотреть файл

Просмотреть файл

@ -1,36 +0,0 @@
#
# Copyright (c) 2016-2019 Intel, Inc. All rights reserved.
# Copyright (c) 2017 IBM Corporation. All rights reserved.
# $COPYRIGHT$
#
# Additional copyrights may follow
#
# $HEADER$
#
sources = \
regx_reverse_component.c \
regx_reverse.h \
regx_reverse.c
# Make the output library in this directory, and name it either
# mca_<type>_<name>.la (for DSO builds) or libmca_<type>_<name>.la
# (for static builds).
if MCA_BUILD_orte_regx_reverse_DSO
component_noinst =
component_install = mca_regx_reverse.la
else
component_noinst = libmca_regx_reverse.la
component_install =
endif
mcacomponentdir = $(ortelibdir)
mcacomponent_LTLIBRARIES = $(component_install)
mca_regx_reverse_la_SOURCES = $(sources)
mca_regx_reverse_la_LDFLAGS = -module -avoid-version
mca_regx_reverse_la_LIBADD = $(top_builddir)/orte/lib@ORTE_LIB_PREFIX@open-rte.la
noinst_LTLIBRARIES = $(component_noinst)
libmca_regx_reverse_la_SOURCES = $(sources)
libmca_regx_reverse_la_LDFLAGS = -module -avoid-version

Просмотреть файл

@ -1,7 +0,0 @@
#
# owner/status file
# owner: institution that is responsible for this package
# status: e.g. active, maintenance, unmaintained
#
owner: IBM
status: active

Просмотреть файл

@ -1,319 +0,0 @@
/*
* Copyright (c) 2016-2019 Intel, Inc. All rights reserved.
* Copyright (c) 2018 IBM Corporation. All rights reserved.
* Copyright (c) 2018 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*
*/
#include "orte_config.h"
#include "orte/types.h"
#include "opal/types.h"
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <ctype.h>
#include "opal/util/argv.h"
#include "opal/util/basename.h"
#include "opal/util/opal_environ.h"
#include "orte/runtime/orte_globals.h"
#include "orte/util/name_fns.h"
#include "orte/util/show_help.h"
#include "orte/mca/errmgr/errmgr.h"
#include "orte/mca/rmaps/base/base.h"
#include "orte/mca/routed/routed.h"
#include "orte/mca/regx/base/base.h"
#include "regx_reverse.h"
static int nidmap_create(opal_pointer_array_t *pool, char **regex);
orte_regx_base_module_t orte_regx_reverse_module = {
.nidmap_create = nidmap_create,
.nidmap_parse = orte_regx_base_nidmap_parse,
.extract_node_names = orte_regx_base_extract_node_names,
.encode_nodemap = orte_regx_base_encode_nodemap,
.decode_daemon_nodemap = orte_regx_base_decode_daemon_nodemap,
.generate_ppn = orte_regx_base_generate_ppn,
.parse_ppn = orte_regx_base_parse_ppn
};
static int nidmap_create(opal_pointer_array_t *pool, char **regex)
{
char *node;
char prefix[ORTE_MAX_NODE_PREFIX];
int i, j, n, len, startnum, nodenum, numdigits;
bool found;
char *suffix, *sfx, *nodenames;
orte_regex_node_t *ndreg;
orte_regex_range_t *range, *rng;
opal_list_t nodenms, dvpids;
opal_list_item_t *item, *itm2;
char **regexargs = NULL, *tmp, *tmp2;
orte_node_t *nptr;
orte_vpid_t vpid;
OBJ_CONSTRUCT(&nodenms, opal_list_t);
OBJ_CONSTRUCT(&dvpids, opal_list_t);
rng = NULL;
for (n=0; n < pool->size; n++) {
if (NULL == (nptr = (orte_node_t*)opal_pointer_array_get_item(pool, n))) {
continue;
}
/* if no daemon has been assigned, then this node is not being used */
if (NULL == nptr->daemon) {
vpid = -1; // indicates no daemon assigned
} else {
vpid = nptr->daemon->name.vpid;
}
/* deal with the daemon vpid - see if it is next in the
* current range */
if (NULL == rng) {
/* just starting */
rng = OBJ_NEW(orte_regex_range_t);
rng->vpid = vpid;
rng->cnt = 1;
opal_list_append(&dvpids, &rng->super);
} else if (UINT32_MAX == vpid) {
if (-1 == rng->vpid) {
rng->cnt++;
} else {
/* need to start another range */
rng = OBJ_NEW(orte_regex_range_t);
rng->vpid = vpid;
rng->cnt = 1;
opal_list_append(&dvpids, &rng->super);
}
} else if (-1 == rng->vpid) {
/* need to start another range */
rng = OBJ_NEW(orte_regex_range_t);
rng->vpid = vpid;
rng->cnt = 1;
opal_list_append(&dvpids, &rng->super);
} else {
/* is this the next in line */
if (vpid == (orte_vpid_t)(rng->vpid + rng->cnt)) {
rng->cnt++;
} else {
/* need to start another range */
rng = OBJ_NEW(orte_regex_range_t);
rng->vpid = vpid;
rng->cnt = 1;
opal_list_append(&dvpids, &rng->super);
}
}
node = nptr->name;
opal_output_verbose(5, orte_regx_base_framework.framework_output,
"%s PROCESS NODE <%s>",
ORTE_NAME_PRINT(ORTE_PROC_MY_NAME),
node);
/* determine this node's prefix by looking for first digit char */
len = strlen(node);
startnum = -1;
memset(prefix, 0, ORTE_MAX_NODE_PREFIX);
numdigits = 0;
/* Valid hostname characters are:
* - ascii letters, digits, and the '-' character.
* Determine the prefix in reverse to better support hostnames like:
* c712f6n01, c699c086 where there are sets of digits, and the lowest
* set changes most frequently.
*/
startnum = -1;
memset(prefix, 0, ORTE_MAX_NODE_PREFIX);
numdigits = 0;
for (i=len-1; i >= 0; i--) {
// Count all of the digits
if( isdigit(node[i]) ) {
numdigits++;
continue;
}
else {
// At this point everything at and above position 'i' is prefix.
for( j = 0; j <= i; ++j) {
prefix[j] = node[j];
}
if (numdigits) {
startnum = j;
}
break;
}
}
opal_output_verbose(5, orte_regx_base_framework.framework_output,
"%s PROCESS NODE <%s> : reverse / prefix \"%s\" / numdigits %d",
ORTE_NAME_PRINT(ORTE_PROC_MY_NAME),
node, prefix, numdigits);
if (startnum < 0) {
/* can't compress this name - just add it to the list */
ndreg = OBJ_NEW(orte_regex_node_t);
ndreg->prefix = strdup(node);
opal_list_append(&nodenms, &ndreg->super);
continue;
}
/* convert the digits and get any suffix */
nodenum = strtol(&node[startnum], &sfx, 10);
if (NULL != sfx) {
suffix = strdup(sfx);
} else {
suffix = NULL;
}
/* is this node name already on our list? */
found = false;
if (0 != opal_list_get_size(&nodenms)) {
ndreg = (orte_regex_node_t*)opal_list_get_last(&nodenms);
if ((0 < strlen(prefix) && NULL == ndreg->prefix) ||
(0 == strlen(prefix) && NULL != ndreg->prefix) ||
(0 < strlen(prefix) && NULL != ndreg->prefix &&
0 != strcmp(prefix, ndreg->prefix)) ||
(NULL == suffix && NULL != ndreg->suffix) ||
(NULL != suffix && NULL == ndreg->suffix) ||
(NULL != suffix && NULL != ndreg->suffix &&
0 != strcmp(suffix, ndreg->suffix)) ||
(numdigits != ndreg->num_digits)) {
found = false;
} else {
/* found a match - flag it */
found = true;
}
}
if (found) {
/* get the last range on this nodeid - we do this
* to preserve order
*/
range = (orte_regex_range_t*)opal_list_get_last(&ndreg->ranges);
if (NULL == range) {
/* first range for this nodeid */
range = OBJ_NEW(orte_regex_range_t);
range->vpid = nodenum;
range->cnt = 1;
opal_list_append(&ndreg->ranges, &range->super);
/* see if the node number is out of sequence */
} else if (nodenum != (range->vpid + range->cnt)) {
/* start a new range */
range = OBJ_NEW(orte_regex_range_t);
range->vpid = nodenum;
range->cnt = 1;
opal_list_append(&ndreg->ranges, &range->super);
} else {
/* everything matches - just increment the cnt */
range->cnt++;
}
} else {
/* need to add it */
ndreg = OBJ_NEW(orte_regex_node_t);
if (0 < strlen(prefix)) {
ndreg->prefix = strdup(prefix);
}
if (NULL != suffix) {
ndreg->suffix = strdup(suffix);
}
ndreg->num_digits = numdigits;
opal_list_append(&nodenms, &ndreg->super);
/* record the first range for this nodeid - we took
* care of names we can't compress above
*/
range = OBJ_NEW(orte_regex_range_t);
range->vpid = nodenum;
range->cnt = 1;
opal_list_append(&ndreg->ranges, &range->super);
}
if (NULL != suffix) {
free(suffix);
}
}
/* begin constructing the regular expression */
while (NULL != (item = opal_list_remove_first(&nodenms))) {
ndreg = (orte_regex_node_t*)item;
/* if no ranges, then just add the name */
if (0 == opal_list_get_size(&ndreg->ranges)) {
if (NULL != ndreg->prefix) {
/* solitary node */
opal_asprintf(&tmp, "%s", ndreg->prefix);
opal_argv_append_nosize(&regexargs, tmp);
free(tmp);
}
OBJ_RELEASE(ndreg);
continue;
}
/* start the regex for this nodeid with the prefix */
if (NULL != ndreg->prefix) {
opal_asprintf(&tmp, "%s[%d:", ndreg->prefix, ndreg->num_digits);
} else {
opal_asprintf(&tmp, "[%d:", ndreg->num_digits);
}
/* add the ranges */
while (NULL != (itm2 = opal_list_remove_first(&ndreg->ranges))) {
range = (orte_regex_range_t*)itm2;
if (1 == range->cnt) {
opal_asprintf(&tmp2, "%s%u,", tmp, range->vpid);
} else {
opal_asprintf(&tmp2, "%s%u-%u,", tmp, range->vpid, range->vpid + range->cnt - 1);
}
free(tmp);
tmp = tmp2;
OBJ_RELEASE(range);
}
/* replace the final comma */
tmp[strlen(tmp)-1] = ']';
if (NULL != ndreg->suffix) {
/* add in the suffix, if provided */
opal_asprintf(&tmp2, "%s%s", tmp, ndreg->suffix);
free(tmp);
tmp = tmp2;
}
opal_argv_append_nosize(&regexargs, tmp);
free(tmp);
OBJ_RELEASE(ndreg);
}
/* assemble final result */
nodenames = opal_argv_join(regexargs, ',');
/* cleanup */
opal_argv_free(regexargs);
OBJ_DESTRUCT(&nodenms);
/* do the same for the vpids */
tmp = NULL;
while (NULL != (item = opal_list_remove_first(&dvpids))) {
rng = (orte_regex_range_t*)item;
if (1 < rng->cnt) {
if (NULL == tmp) {
opal_asprintf(&tmp, "%u(%u)", rng->vpid, rng->cnt);
} else {
opal_asprintf(&tmp2, "%s,%u(%u)", tmp, rng->vpid, rng->cnt);
free(tmp);
tmp = tmp2;
}
} else {
if (NULL == tmp) {
opal_asprintf(&tmp, "%u", rng->vpid);
} else {
opal_asprintf(&tmp2, "%s,%u", tmp, rng->vpid);
free(tmp);
tmp = tmp2;
}
}
OBJ_RELEASE(rng);
}
OPAL_LIST_DESTRUCT(&dvpids);
/* now concatenate the results into one string */
opal_asprintf(&tmp2, "%s@%s", nodenames, tmp);
free(nodenames);
free(tmp);
*regex = tmp2;
return ORTE_SUCCESS;
}

Просмотреть файл

@ -1,28 +0,0 @@
/*
* Copyright (c) 2016-2019 Intel, Inc. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
#ifndef _MCA_REGX_REVERSE_H_
#define _MCA_REGX_REVERSE_H_
#include "orte_config.h"
#include "orte/types.h"
#include "opal/mca/base/base.h"
#include "orte/mca/regx/regx.h"
BEGIN_C_DECLS
ORTE_MODULE_DECLSPEC extern orte_regx_base_component_t mca_regx_reverse_component;
extern orte_regx_base_module_t orte_regx_reverse_module;
END_C_DECLS
#endif /* MCA_REGX_ORTE_H_ */

Просмотреть файл

@ -1,44 +0,0 @@
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
/*
* Copyright (c) 2016-2019 Intel, Inc. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
#include "orte_config.h"
#include "orte/types.h"
#include "opal/types.h"
#include "opal/util/show_help.h"
#include "orte/mca/regx/regx.h"
#include "regx_reverse.h"
static int component_query(mca_base_module_t **module, int *priority);
/*
* Struct of function pointers and all that to let us be initialized
*/
orte_regx_base_component_t mca_regx_reverse_component = {
.base_version = {
MCA_REGX_BASE_VERSION_1_0_0,
.mca_component_name = "reverse",
MCA_BASE_MAKE_VERSION(component, ORTE_MAJOR_VERSION, ORTE_MINOR_VERSION,
ORTE_RELEASE_VERSION),
.mca_query_component = component_query,
},
.base_data = {
/* The component is checkpoint ready */
MCA_BASE_METADATA_PARAM_CHECKPOINT
},
};
static int component_query(mca_base_module_t **module, int *priority)
{
*module = (mca_base_module_t*)&orte_regx_reverse_module;
*priority = 1;
return ORTE_SUCCESS;
}

Просмотреть файл

@ -1,42 +0,0 @@
#
# Copyright (c) 2004-2010 The Trustees of Indiana University.
# All rights reserved.
# Copyright (c) 2014-2015 Cisco Systems, Inc. All rights reserved.
# Copyright (c) 2017 IBM Corporation. All rights reserved.
# Copyright (c) 2019 Intel, Inc. All rights reserved.
# $COPYRIGHT$
#
# Additional copyrights may follow
#
# $HEADER$
#
AM_CPPFLAGS = $(compress_zlib_CPPFLAGS)
sources = \
compress_zlib.h \
compress_zlib_component.c \
compress_zlib.c
# Make the output library in this directory, and name it either
# mca_<type>_<name>.la (for DSO builds) or libmca_<type>_<name>.la
# (for static builds).
if MCA_BUILD_opal_compress_zlib_DSO
component_noinst =
component_install = mca_compress_zlib.la
else
component_noinst = libmca_compress_zlib.la
component_install =
endif
mcacomponentdir = $(opallibdir)
mcacomponent_LTLIBRARIES = $(component_install)
mca_compress_zlib_la_SOURCES = $(sources)
mca_compress_zlib_la_LDFLAGS = -module -avoid-version $(compress_zlib_LDFLAGS)
mca_compress_zlib_la_LIBADD = $(top_builddir)/opal/lib@OPAL_LIB_PREFIX@open-pal.la $(compress_zlib_LIBS)
noinst_LTLIBRARIES = $(component_noinst)
libmca_compress_zlib_la_SOURCES = $(sources)
libmca_compress_zlib_la_LDFLAGS = -module -avoid-version $(compress_zlib_LDFLAGS)
libmca_compress_zlib_la_LIBADD = $(compress_zlib_LIBS)

Просмотреть файл

@ -1,133 +0,0 @@
/*
* Copyright (c) 2004-2010 The Trustees of Indiana University.
* All rights reserved.
* Copyright (c) 2010 Oracle and/or its affiliates. All rights reserved.
*
* Copyright (c) 2014 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2015 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
* Copyright (c) 2018 Amazon.com, Inc. or its affiliates. All Rights reserved.
* Copyright (c) 2019 Intel, Inc. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
#include "opal_config.h"
#include <string.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <sys/stat.h>
#if HAVE_UNISTD_H
#include <unistd.h>
#endif /* HAVE_UNISTD_H */
#include <zlib.h>
#include "opal/util/opal_environ.h"
#include "opal/util/output.h"
#include "opal/util/argv.h"
#include "opal/util/opal_environ.h"
#include "opal/util/printf.h"
#include "opal/constants.h"
#include "opal/util/basename.h"
#include "opal/mca/compress/compress.h"
#include "opal/mca/compress/base/base.h"
#include "compress_zlib.h"
int opal_compress_zlib_module_init(void)
{
return OPAL_SUCCESS;
}
int opal_compress_zlib_module_finalize(void)
{
return OPAL_SUCCESS;
}
bool opal_compress_zlib_compress_block(uint8_t *inbytes,
size_t inlen,
uint8_t **outbytes,
size_t *olen)
{
z_stream strm;
size_t len;
uint8_t *tmp;
if (inlen < opal_compress_base.compress_limit) {
return false;
}
opal_output_verbose(2, opal_compress_base_framework.framework_output,
"COMPRESSING");
/* set default output */
*outbytes = NULL;
*olen = 0;
/* setup the stream */
memset (&strm, 0, sizeof (strm));
deflateInit (&strm, 9);
/* get an upper bound on the required output storage */
len = deflateBound(&strm, inlen);
if (NULL == (tmp = (uint8_t*)malloc(len))) {
return false;
}
strm.next_in = inbytes;
strm.avail_in = inlen;
/* allocating the upper bound guarantees zlib will
* always successfully compress into the available space */
strm.avail_out = len;
strm.next_out = tmp;
deflate (&strm, Z_FINISH);
deflateEnd (&strm);
*outbytes = tmp;
*olen = len - strm.avail_out;
opal_output_verbose(2, opal_compress_base_framework.framework_output,
"\tINSIZE %d OUTSIZE %d", (int)inlen, (int)*olen);
return true; // we did the compression
}
bool opal_compress_zlib_uncompress_block(uint8_t **outbytes, size_t olen,
uint8_t *inbytes, size_t len)
{
uint8_t *dest;
z_stream strm;
/* set the default error answer */
*outbytes = NULL;
opal_output_verbose(2, opal_compress_base_framework.framework_output, "DECOMPRESS");
/* setting destination to the fully decompressed size */
dest = (uint8_t*)malloc(olen);
if (NULL == dest) {
return false;
}
memset (&strm, 0, sizeof (strm));
if (Z_OK != inflateInit(&strm)) {
free(dest);
return false;
}
strm.avail_in = len;
strm.next_in = inbytes;
strm.avail_out = olen;
strm.next_out = dest;
if (Z_STREAM_END != inflate (&strm, Z_FINISH)) {
opal_output(0, "\tDECOMPRESS FAILED: %s", strm.msg);
}
inflateEnd (&strm);
*outbytes = dest;
opal_output_verbose(2, opal_compress_base_framework.framework_output,
"\tINSIZE: %d OUTSIZE %d", (int)len, (int)olen);
return true;
}

Просмотреть файл

@ -1,66 +0,0 @@
/*
* Copyright (c) 2004-2010 The Trustees of Indiana University.
* All rights reserved.
* Copyright (c) 2019 Intel, Inc. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
/**
* @file
*
* ZLIB COMPRESS component
*
* Uses the zlib library
*/
#ifndef MCA_COMPRESS_ZLIB_EXPORT_H
#define MCA_COMPRESS_ZLIB_EXPORT_H
#include "opal_config.h"
#include "opal/util/output.h"
#include "opal/mca/mca.h"
#include "opal/mca/compress/compress.h"
#if defined(c_plusplus) || defined(__cplusplus)
extern "C" {
#endif
/*
* Local Component structures
*/
struct opal_compress_zlib_component_t {
opal_compress_base_component_t super; /** Base COMPRESS component */
};
typedef struct opal_compress_zlib_component_t opal_compress_zlib_component_t;
extern opal_compress_zlib_component_t mca_compress_zlib_component;
int opal_compress_zlib_component_query(mca_base_module_t **module, int *priority);
/*
* Module functions
*/
int opal_compress_zlib_module_init(void);
int opal_compress_zlib_module_finalize(void);
/*
* Actual funcationality
*/
bool opal_compress_zlib_compress_block(uint8_t *inbytes,
size_t inlen,
uint8_t **outbytes,
size_t *olen);
bool opal_compress_zlib_uncompress_block(uint8_t **outbytes, size_t olen,
uint8_t *inbytes, size_t len);
#if defined(c_plusplus) || defined(__cplusplus)
}
#endif
#endif /* MCA_COMPRESS_ZLIB_EXPORT_H */

Просмотреть файл

@ -1,149 +0,0 @@
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
/*
* Copyright (c) 2004-2010 The Trustees of Indiana University.
* All rights reserved.
* Copyright (c) 2015 Los Alamos National Security, LLC. All rights
* reserved.
* Copyright (c) 2019 Intel, Inc. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
#include "opal_config.h"
#include "opal/constants.h"
#include "opal/mca/compress/compress.h"
#include "opal/mca/compress/base/base.h"
#include "compress_zlib.h"
/*
* Public string for version number
*/
const char *opal_compress_zlib_component_version_string =
"OPAL COMPRESS zlib MCA component version " OPAL_VERSION;
/*
* Local functionality
*/
static int compress_zlib_register (void);
static int compress_zlib_open(void);
static int compress_zlib_close(void);
/*
* Instantiate the public struct with all of our public information
* and pointer to our public functions in it
*/
opal_compress_zlib_component_t mca_compress_zlib_component = {
/* First do the base component stuff */
{
/* Handle the general mca_component_t struct containing
* meta information about the component itzlib
*/
.base_version = {
OPAL_COMPRESS_BASE_VERSION_2_0_0,
/* Component name and version */
.mca_component_name = "zlib",
MCA_BASE_MAKE_VERSION(component, OPAL_MAJOR_VERSION, OPAL_MINOR_VERSION,
OPAL_RELEASE_VERSION),
/* Component open and close functions */
.mca_open_component = compress_zlib_open,
.mca_close_component = compress_zlib_close,
.mca_query_component = opal_compress_zlib_component_query,
.mca_register_component_params = compress_zlib_register
},
.base_data = {
/* The component is checkpoint ready */
MCA_BASE_METADATA_PARAM_CHECKPOINT
},
.verbose = 0,
.output_handle = -1,
}
};
/*
* Zlib module
*/
static opal_compress_base_module_t loc_module = {
/** Initialization Function */
.init = opal_compress_zlib_module_init,
/** Finalization Function */
.finalize = opal_compress_zlib_module_finalize,
/** Compress Function */
.compress_block = opal_compress_zlib_compress_block,
/** Decompress Function */
.decompress_block = opal_compress_zlib_uncompress_block,
};
static int compress_zlib_register (void)
{
int ret;
mca_compress_zlib_component.super.priority = 50;
ret = mca_base_component_var_register (&mca_compress_zlib_component.super.base_version,
"priority", "Priority of the COMPRESS zlib component "
"(default: 50)", MCA_BASE_VAR_TYPE_INT, NULL, 0,
MCA_BASE_VAR_FLAG_SETTABLE,
OPAL_INFO_LVL_9, MCA_BASE_VAR_SCOPE_ALL_EQ,
&mca_compress_zlib_component.super.priority);
if (0 > ret) {
return ret;
}
mca_compress_zlib_component.super.verbose = 0;
ret = mca_base_component_var_register (&mca_compress_zlib_component.super.base_version,
"verbose",
"Verbose level for the COMPRESS zlib component",
MCA_BASE_VAR_TYPE_INT, NULL, 0, MCA_BASE_VAR_FLAG_SETTABLE,
OPAL_INFO_LVL_9, MCA_BASE_VAR_SCOPE_LOCAL,
&mca_compress_zlib_component.super.verbose);
return (0 > ret) ? ret : OPAL_SUCCESS;
}
static int compress_zlib_open(void)
{
/* If there is a custom verbose level for this component than use it
* otherwise take our parents level and output channel
*/
if ( 0 != mca_compress_zlib_component.super.verbose) {
mca_compress_zlib_component.super.output_handle = opal_output_open(NULL);
opal_output_set_verbosity(mca_compress_zlib_component.super.output_handle,
mca_compress_zlib_component.super.verbose);
} else {
mca_compress_zlib_component.super.output_handle = opal_compress_base_framework.framework_output;
}
/*
* Debug output
*/
opal_output_verbose(10, mca_compress_zlib_component.super.output_handle,
"compress:zlib: open()");
opal_output_verbose(20, mca_compress_zlib_component.super.output_handle,
"compress:zlib: open: priority = %d",
mca_compress_zlib_component.super.priority);
opal_output_verbose(20, mca_compress_zlib_component.super.output_handle,
"compress:zlib: open: verbosity = %d",
mca_compress_zlib_component.super.verbose);
return OPAL_SUCCESS;
}
static int compress_zlib_close(void)
{
return OPAL_SUCCESS;
}
int opal_compress_zlib_component_query(mca_base_module_t **module, int *priority)
{
*module = (mca_base_module_t *)&loc_module;
*priority = mca_compress_zlib_component.super.priority;
return OPAL_SUCCESS;
}

Просмотреть файл

@ -1,102 +0,0 @@
# -*- shell-script -*-
#
# Copyright (c) 2009-2015 Cisco Systems, Inc. All rights reserved.
# Copyright (c) 2013 Los Alamos National Security, LLC. All rights reserved.
# Copyright (c) 2013-2019 Intel, Inc. All rights reserved.
# $COPYRIGHT$
#
# Additional copyrights may follow
#
# $HEADER$
#
# MCA_compress_zlib_CONFIG([action-if-can-compile],
# [action-if-cant-compile])
# ------------------------------------------------
AC_DEFUN([MCA_opal_compress_zlib_CONFIG],[
AC_CONFIG_FILES([opal/mca/compress/zlib/Makefile])
OPAL_VAR_SCOPE_PUSH([opal_zlib_dir opal_zlib_libdir opal_zlib_standard_lib_location opal_zlib_standard_header_location opal_check_zlib_save_CPPFLAGS opal_check_zlib_save_LDFLAGS opal_check_zlib_save_LIBS])
AC_ARG_WITH([zlib],
[AC_HELP_STRING([--with-zlib=DIR],
[Search for zlib headers and libraries in DIR ])])
AC_ARG_WITH([zlib-libdir],
[AC_HELP_STRING([--with-zlib-libdir=DIR],
[Search for zlib libraries in DIR ])])
opal_check_zlib_save_CPPFLAGS="$CPPFLAGS"
opal_check_zlib_save_LDFLAGS="$LDFLAGS"
opal_check_zlib_save_LIBS="$LIBS"
opal_zlib_support=0
if test "$with_zlib" != "no"; then
AC_MSG_CHECKING([for zlib in])
if test ! -z "$with_zlib" && test "$with_zlib" != "yes"; then
opal_zlib_dir=$with_zlib
opal_zlib_source=$with_zlib
opal_zlib_standard_header_location=no
opal_zlib_standard_lib_location=no
AS_IF([test -z "$with_zlib_libdir" || test "$with_zlib_libdir" = "yes"],
[if test -d $with_zlib/lib; then
opal_zlib_libdir=$with_zlib/lib
elif test -d $with_zlib/lib64; then
opal_zlib_libdir=$with_zlib/lib64
else
AC_MSG_RESULT([Could not find $with_zlib/lib or $with_zlib/lib64])
AC_MSG_ERROR([Can not continue])
fi
AC_MSG_RESULT([$opal_zlib_dir and $opal_zlib_libdir])],
[AC_MSG_RESULT([$with_zlib_libdir])])
else
AC_MSG_RESULT([(default search paths)])
opal_zlib_source=standard
opal_zlib_standard_header_location=yes
opal_zlib_standard_lib_location=yes
fi
AS_IF([test ! -z "$with_zlib_libdir" && test "$with_zlib_libdir" != "yes"],
[opal_zlib_libdir="$with_zlib_libdir"
opal_zlib_standard_lib_location=no])
OPAL_CHECK_PACKAGE([compress_zlib],
[zlib.h],
[z],
[deflate],
[-lz],
[$opal_zlib_dir],
[$opal_zlib_libdir],
[opal_zlib_support=1],
[opal_zlib_support=0])
fi
if test ! -z "$with_zlib" && test "$with_zlib" != "no" && test "$opal_zlib_support" != "1"; then
AC_MSG_WARN([ZLIB SUPPORT REQUESTED AND NOT FOUND])
AC_MSG_ERROR([CANNOT CONTINUE])
fi
AC_MSG_CHECKING([will zlib support be built])
if test "$opal_zlib_support" != "1"; then
AC_MSG_RESULT([no])
else
AC_MSG_RESULT([yes])
fi
CPPFLAGS="$opal_check_zlib_save_CPPFLAGS"
LDFLAGS="$opal_check_zlib_save_LDFLAGS"
LIBS="$opal_check_zlib_save_LIBS"
AS_IF([test "$opal_zlib_support" = "1"],
[$1
OPAL_SUMMARY_ADD([[External Packages]],[[ZLIB]], [opal_zlib], [yes ($opal_zlib_source)])],
[$2])
# substitute in the things needed to build this component
AC_SUBST([compress_zlib_CFLAGS])
AC_SUBST([compress_zlib_CPPFLAGS])
AC_SUBST([compress_zlib_LDFLAGS])
AC_SUBST([compress_zlib_LIBS])
OPAL_VAR_SCOPE_POP
])dnl

Просмотреть файл

@ -1,7 +0,0 @@
#
# owner/status file
# owner: institution that is responsible for this package
# status: e.g. active, maintenance, unmaintained
#
owner:project
status:maintenance

Просмотреть файл

@ -10,7 +10,7 @@
* University of Stuttgart. All rights reserved.
* Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved.
* Copyright (c) 2007-2016 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2007-2020 Cisco Systems, Inc. All rights reserved
* Copyright (c) 2007 Sun Microsystems, Inc. All rights reserved.
* Copyright (c) 2009 Oak Ridge National Labs. All rights reserved.
* Copyright (c) 2010-2015 Los Alamos National Security, LLC.
@ -61,7 +61,6 @@
#include "opal/mca/if/base/base.h"
#include "opal/dss/dss.h"
#include "opal/mca/shmem/base/base.h"
#include "opal/mca/compress/base/base.h"
#include "opal/threads/threads.h"
#include "opal/threads/tsd.h"
@ -627,7 +626,7 @@ opal_init_util(int* pargc, char*** pargv)
static mca_base_framework_t *opal_init_frameworks[] = {
&opal_hwloc_base_framework, &opal_memcpy_base_framework, &opal_memchecker_base_framework,
&opal_backtrace_base_framework, &opal_timer_base_framework, &opal_event_base_framework,
&opal_shmem_base_framework, &opal_reachable_base_framework, &opal_compress_base_framework,
&opal_shmem_base_framework, &opal_reachable_base_framework,
NULL,
};
@ -689,10 +688,5 @@ opal_init(int* pargc, char*** pargv)
return opal_init_error ("opal_reachable_base_select", ret);
}
/* Intitialize compress framework */
if (OPAL_SUCCESS != (ret = opal_compress_base_select())) {
return opal_init_error ("opal_compress_base_select", ret);
}
return OPAL_SUCCESS;
}