Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove DebugMode from all external APIs #3204

Merged
merged 4 commits into from
Jun 22, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CTestCustom.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ list(APPEND CTEST_CUSTOM_WARNING_EXCEPTION
"was built for newer macOS version"
"warning generated"
"warnings generated"
"warning: template parameter ... is not used in declaring the parameter types of function template"
)
list(APPEND CTEST_CUSTOM_COVERAGE_EXCLUDE
".*/thirdparty/.*"
Expand Down
21 changes: 13 additions & 8 deletions bindings/C/adios2/c/adios2_c_adios.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,8 @@ adios2::ArrayOrdering adios2_ToArrayOrdering(const adios2_arrayordering Corder)
}

adios2_adios *adios2_init_config_glue_serial(const char *config_file,
const adios2_debug_mode debug_mode,
const char *host_language)
{
// The debug_mode argument is no longer used, but kept in the public
// API for compatibility.
static_cast<void>(debug_mode);

adios2_adios *adios = nullptr;
try
{
Expand All @@ -67,13 +62,23 @@ adios2_adios *adios2_init_config_glue_serial(const char *config_file,

adios2_adios *adios2_init_serial()
{
return adios2_init_config_glue_serial("", adios2_debug_mode_off, "C");
return adios2_init_config_glue_serial("", "C");
}

adios2_adios *adios2_init_serial_debug(adios2_debug_mode)
{
return adios2_init_serial();
}

adios2_adios *adios2_init_config_serial(const char *config_file)
{
return adios2_init_config_glue_serial(config_file, adios2_debug_mode_off,
"C");
return adios2_init_config_glue_serial(config_file, "C");
}

adios2_adios *adios2_init_config_serial_debug(const char *config_file,
adios2_debug_mode)
{
return adios2_init_config_serial(config_file);
}

adios2_io *adios2_declare_io(adios2_adios *adios, const char *name)
Expand Down
27 changes: 21 additions & 6 deletions bindings/C/adios2/c/adios2_c_adios.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ extern "C" {
#endif

#if ADIOS2_USE_MPI
#define adios2_init(comm, debug_mode) adios2_init_mpi(comm)
#define adios2_init_config(config_file, comm, debug_mode) \
adios2_init_config_mpi(config_file, comm)
#define adios2_init(comm, debug) adios2_init_mpi_debug(comm, debug)
#define adios2_init_config(config_file, comm, debug) \
adios2_init_config_mpi_debug(config_file, comm, debug)

/**
* Starting point for MPI apps. Creates an ADIOS handler.
Expand All @@ -34,6 +34,9 @@ extern "C" {
*/
adios2_adios *adios2_init_mpi(MPI_Comm comm);

ADIOS2_DEPRECATED
adios2_adios *adios2_init_mpi_debug(MPI_Comm comm, adios2_debug_mode);

/**
* Starting point for MPI apps. Creates an ADIOS handler allowing a runtime
* config file.
Expand All @@ -44,10 +47,15 @@ adios2_adios *adios2_init_mpi(MPI_Comm comm);
* @return success: handler, failure: NULL
*/
adios2_adios *adios2_init_config_mpi(const char *config_file, MPI_Comm comm);

ADIOS2_DEPRECATED
adios2_adios *adios2_init_config_mpi_debug(const char *config_file,
MPI_Comm comm, adios2_debug_mode);

#else
#define adios2_init(debug_mode) adios2_init_serial()
#define adios2_init_config(config_file, debug_mode) \
adios2_init_config_serial(config_file)
#define adios2_init(debug) adios2_init_serial_debug(debug)
#define adios2_init_config(config_file, debug) \
adios2_init_config_serial_debug(config_file, debug)
#endif

/**
Expand All @@ -57,13 +65,20 @@ adios2_adios *adios2_init_config_mpi(const char *config_file, MPI_Comm comm);
*/
adios2_adios *adios2_init_serial(void);

ADIOS2_DEPRECATED
adios2_adios *adios2_init_serial_debug(adios2_debug_mode);

/**
* Initialize an ADIOS struct pointer handler in a serial, non-MPI application.
* Doesn't require a runtime config file.
* @return success: handler, failure: NULL
*/
adios2_adios *adios2_init_config_serial(const char *config_file);

ADIOS2_DEPRECATED
adios2_adios *adios2_init_config_serial_debug(const char *config_file,
adios2_debug_mode);

/**
* Declares a new io handler
* @param adios owner the io handler
Expand Down
17 changes: 13 additions & 4 deletions bindings/C/adios2/c/adios2_c_adios_mpi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ extern "C" {
// to be called from other languages, hidden from the public apis
adios2_adios *adios2_init_config_glue_mpi(const char *config_file,
MPI_Comm comm,
const adios2_debug_mode debug_mode,
const char *host_language)
{
adios2_adios *adios = nullptr;
Expand All @@ -39,13 +38,23 @@ adios2_adios *adios2_init_config_glue_mpi(const char *config_file,

adios2_adios *adios2_init_mpi(MPI_Comm comm)
{
return adios2_init_config_glue_mpi("", comm, adios2_debug_mode_off, "C");
return adios2_init_config_glue_mpi("", comm, "C");
}

adios2_adios *adios2_init_mpi_debug(MPI_Comm comm, adios2_debug_mode)
{
return adios2_init_mpi(comm);
}

adios2_adios *adios2_init_config_mpi(const char *config_file, MPI_Comm comm)
{
return adios2_init_config_glue_mpi(config_file, comm, adios2_debug_mode_off,
"C");
return adios2_init_config_glue_mpi(config_file, comm, "C");
}

adios2_adios *adios2_init_config_mpi_debug(const char *config_file,
MPI_Comm comm, adios2_debug_mode)
{
return adios2_init_config_mpi(config_file, comm);
}

} // end extern C
4 changes: 2 additions & 2 deletions bindings/C/adios2/c/adios2_c_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,7 @@ typedef enum
adios2_error_none = 0,

/**
* user input error, on when adios2_debug_mode_on is passed to adios2_init
* or adios2_init_config
* user input error
*/
adios2_error_invalid_argument = 1,

Expand All @@ -62,6 +61,7 @@ typedef enum
adios2_true = 1,
} adios2_bool;

/* DEPRECATED: Debug mode will be removed in a future release */
typedef enum
{
adios2_debug_mode_off = 0,
Expand Down
4 changes: 1 addition & 3 deletions bindings/CXX11/adios2.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,11 @@
#include "adios2/common/ADIOSMacros.h"
#include "adios2/common/ADIOSTypes.h"

// DEPRECATED: Debug mode will be removed in a future release
namespace adios2
{

// adios alias values and types. These not used internally and deprecated.
constexpr bool DebugON = true;
constexpr bool DebugOFF = false;

} // end namespace adios2

#include "adios2/cxx11/ADIOS.h"
Expand Down
9 changes: 3 additions & 6 deletions bindings/CXX11/adios2/cxx11/ADIOS.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,14 @@

namespace adios2
{
ADIOS::ADIOS(const std::string &configFile, const bool debugMode)
ADIOS::ADIOS(const std::string &configFile)
: m_ADIOS(std::make_shared<core::ADIOS>(configFile, "C++"))
{
}

ADIOS::ADIOS(const char *configFile) : ADIOS(std::string(configFile), "C++") {}
ADIOS::ADIOS() : ADIOS("", "C++") {}

ADIOS::ADIOS(const bool debugMode) : ADIOS("", "C++") {}

ADIOS::ADIOS(const std::string &configFile, const std::string &hostLanguage,
const bool debugMode)
ADIOS::ADIOS(const std::string &configFile, const std::string &hostLanguage)
: m_ADIOS(std::make_shared<core::ADIOS>(configFile, hostLanguage))
{
}
Expand Down
81 changes: 48 additions & 33 deletions bindings/CXX11/adios2/cxx11/ADIOS.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
#include <functional>
#include <memory>
#include <string>
#include <type_traits>

#include "IO.h"
#include "Operator.h"
Expand Down Expand Up @@ -41,15 +42,23 @@ class ADIOS
{

public:
template <class T>
using enable_if_bool =
typename std::enable_if<std::is_same<T, bool>::value, bool>::type;

#if ADIOS2_USE_MPI
/**
* Starting point for MPI apps. Creates an ADIOS object.
* MPI Collective Operation as it call MPI_Comm_dup
* @param comm defines domain scope from application
* @param debugMode is deprecated and has no effect on library behavior
* @exception std::invalid_argument if user input is incorrect
*/
ADIOS(MPI_Comm comm, const bool debugMode = true);
ADIOS(MPI_Comm comm);

template <typename TDebugMode, enable_if_bool<TDebugMode> Enable = true>
ADIOS2_DEPRECATED ADIOS(MPI_Comm comm, TDebugMode) : ADIOS(comm)
{
}

/**
* Starting point for MPI apps. Creates an ADIOS object allowing a
Expand All @@ -58,11 +67,16 @@ class ADIOS
* configFile contents
* @param configFile runtime config file
* @param comm defines domain scope from application
* @param debugMode is deprecated and has no effect on library behavior
* @exception std::invalid_argument if user input is incorrect
*/
ADIOS(const std::string &configFile, MPI_Comm comm,
const bool debugMode = true);
ADIOS(const std::string &configFile, MPI_Comm comm);

template <typename TDebugMode, enable_if_bool<TDebugMode> Enable = true>
ADIOS2_DEPRECATED ADIOS(const std::string &configFile, MPI_Comm comm,
TDebugMode)
: ADIOS(configFile, comm)
{
}

/** extra constructor for R and other languages that use the
* public C++ API but has data in column-major. Pass "" for configfile
Expand All @@ -74,46 +88,41 @@ class ADIOS
* e.g. adios2::ADIOS("", comm, "Fortran", false);
*/
ADIOS(const std::string &configFile, MPI_Comm comm,
const std::string &hostLanguage, const bool debugMode);
#else
// Client code that does not enable ADIOS2_USE_MPI may accidentally
// try to pass a MPI_Comm instance to our constructor. If the type
// the MPI library uses to implement MPI_Comm happens to be convertible
// to one of the types offered by our serial constructors (e.g. 'bool'),
// the invocation will appear to succeed but will ignore the
// communicator passed. Add explicitly deleted constructors that have
// better conversions for common MPI_Comm types.

// openmpi uses 'ompi_communicator_t*' for MPI_Comm
ADIOS(void *define_ADIOS2_USE_MPI_to_use_MPI_constructor) = delete;

// mpich uses 'int' for MPI_Comm
ADIOS(int define_ADIOS2_USE_MPI_to_use_MPI_constructor) = delete;
const std::string &hostLanguage);

template <typename TDebugMode, enable_if_bool<TDebugMode> Enable = true>
ADIOS2_DEPRECATED ADIOS(const std::string &configFile, MPI_Comm comm,
const std::string &hostLanguage, TDebugMode)
: ADIOS(configFile, comm, hostLanguage)
{
}

#endif

/**
* Starting point for non-MPI serial apps. Creates an ADIOS object allowing
* a runtime config file.
* @param configFile runtime config file
* @param debugMode is deprecated and has no effect on library behavior
* @exception std::invalid_argument if user input is incorrect
*/
ADIOS(const std::string &configFile, const bool debugMode = true);
ADIOS(const std::string &configFile);

/**
* Starting point for non-MPI serial apps. Creates an ADIOS object allowing
* a runtime config file.
* @param configFile runtime config file
* @exception std::invalid_argument if user input is incorrect
*/
ADIOS(const char *configFile);
template <typename TDebugMode, enable_if_bool<TDebugMode> Enable = true>
ADIOS2_DEPRECATED ADIOS(const std::string &configFile, TDebugMode)
: ADIOS(configFile)
{
}

/**
* Starting point for non-MPI apps. Creates an ADIOS object
* @param debugMode is deprecated and has no effect on library behavior
* @exception std::invalid_argument if user input is incorrect
*/
ADIOS(const bool debugMode = true);
ADIOS();

template <typename TDebugMode, enable_if_bool<TDebugMode> Enable = true>
ADIOS2_DEPRECATED ADIOS(TDebugMode) : ADIOS()
{
}

/** extra constructor for R and other languages that use the
* public C++ API but has data in column-major. Pass "" for configfile
Expand All @@ -124,8 +133,14 @@ class ADIOS
* treat all arrays column-major
* e.g. adios2::ADIOS("", "Fortran", false);
*/
ADIOS(const std::string &configFile, const std::string &hostLanguage,
const bool debugMode);
ADIOS(const std::string &configFile, const std::string &hostLanguage);

template <typename TDebugMode, enable_if_bool<TDebugMode> Enable = true>
ADIOS2_DEPRECATED ADIOS(const std::string &configFile,
const std::string &hostLanguage, TDebugMode)
: ADIOS(configFile, hostLanguage)
{
}

/** object inspection true: valid object, false: invalid object */
explicit operator bool() const noexcept;
Expand Down
6 changes: 3 additions & 3 deletions bindings/CXX11/adios2/cxx11/ADIOSMPI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,16 @@

namespace adios2
{
ADIOS::ADIOS(const std::string &configFile, MPI_Comm comm, const bool debugMode)
ADIOS::ADIOS(const std::string &configFile, MPI_Comm comm)
: m_ADIOS(std::make_shared<core::ADIOS>(configFile, helper::CommDupMPI(comm),
"C++"))
{
}

ADIOS::ADIOS(MPI_Comm comm, const bool debugMode) : ADIOS("", comm) {}
ADIOS::ADIOS(MPI_Comm comm) : ADIOS("", comm) {}

ADIOS::ADIOS(const std::string &configFile, MPI_Comm comm,
const std::string &hostLanguage, const bool debugMode = true)
const std::string &hostLanguage)
: m_ADIOS(std::make_shared<core::ADIOS>(configFile, helper::CommDupMPI(comm),
hostLanguage))
{
Expand Down
16 changes: 6 additions & 10 deletions bindings/Fortran/f2c/adios2_f2c_adios.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,28 +15,24 @@ extern "C" {
#endif

// this function is not exposed in the public APIs
extern adios2_adios *
adios2_init_config_glue_serial(const char *config_file,
const adios2_debug_mode debug_mode,
const char *host_language);
extern adios2_adios *adios2_init_config_glue_serial(const char *config_file,
const char *host_language);

void FC_GLOBAL(adios2_init_config_serial_f2c,
ADIOS2_INIT_CONFIG_SERIAL_F2C)(adios2_adios **adios,
const char *config_file,
const int *debug_mode, int *ierr)
int *ierr)
{
*adios = adios2_init_config_glue_serial(
config_file, static_cast<adios2_debug_mode>(*debug_mode), "Fortran");
*adios = adios2_init_config_glue_serial(config_file, "Fortran");
*ierr = (*adios == NULL) ? static_cast<int>(adios2_error_exception)
: static_cast<int>(adios2_error_none);
}

void FC_GLOBAL(adios2_init_serial_f2c,
ADIOS2_INIT_SERIAL_F2C)(adios2_adios **adios,
const int *debug_mode, int *ierr)
ADIOS2_INIT_SERIAL_F2C)(adios2_adios **adios, int *ierr)
{
FC_GLOBAL(adios2_init_config_serial_f2c, ADIOS2_INIT_CONFIG_SERIAL_F2C)
(adios, "", debug_mode, ierr);
(adios, "", ierr);
}

void FC_GLOBAL(adios2_declare_io_f2c,
Expand Down
Loading