Skip to content

Commit

Permalink
Merge pull request #1187 from germasch/stdtype
Browse files Browse the repository at this point in the history
change core etc to explicitly only handle stdint-based types
  • Loading branch information
williamfgc authored Feb 15, 2019
2 parents b18837c + e33adaf commit 8d5e22a
Show file tree
Hide file tree
Showing 83 changed files with 216 additions and 533 deletions.
4 changes: 2 additions & 2 deletions Contributing.md
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ private:
#define declare_explicit_instantiation(T) \
extern template void Foo::Bar1<T>();

ADIOS_FOREACH_TYPE_1ARG(declare_explicit_instantiation)
ADIOS_FOREACH_STDTYPE_1ARG(declare_explicit_instantiation)
#undef(declare_explicit_instantiation)
} // end namespace adios

Expand Down Expand Up @@ -339,7 +339,7 @@ void Foo::Bar3Helper()
#define define_explicit_instantiation(T) \
template void Foo::Bar1<T>();

ADIOS_FOREACH_TYPE_1ARG(define_explicit_instantiation)
ADIOS_FOREACH_STDTYPE_1ARG(define_explicit_instantiation)
#undef(define_explicit_instantiation)

} // end namespace adios
Expand Down
59 changes: 0 additions & 59 deletions bindings/Matlab/adiosopenc.c
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,6 @@ static int verbose = 0;

mxClassID adiostypeToMatlabClass(int adiostype, mxComplexity *complexity);
size_t adiostypeToMemSize(adios2_type adiostype);
mxClassID adiostypestringToMatlabClass(const char *type,
mxComplexity *complexity);
mxArray *valueToMatlabValue(const void *data, mxClassID mxtype,
mxComplexity complexFlag);
mxArray *arrayToMatlabArray(const void *data, const size_t nelems, mxClassID mxtype,
Expand Down Expand Up @@ -633,63 +631,6 @@ size_t adiostypeToMemSize(adios2_type adiostype)
return 0; /* just to avoid warnings. never executed */
}

/** return the appropriate class for an adios type (and complexity too) */
mxClassID adiostypestringToMatlabClass(const char *type,
mxComplexity *complexity)
{
*complexity = mxREAL;
if (!strcmp(type, "char"))
return mxINT8_CLASS;
else if (!strcmp(type, "unsigned char"))
return mxUINT8_CLASS;
else if (!strcmp(type, "short"))
return mxINT16_CLASS;
else if (!strcmp(type, "unsigned short"))
return mxUINT16_CLASS;
else if (!strcmp(type, "int"))
return mxINT32_CLASS;
else if (!strcmp(type, "unsigned int"))
return mxUINT32_CLASS;
else if (!strcmp(type, "long int"))
{
if (sizeof(long int) == 4)
return mxINT32_CLASS;
else
return mxINT64_CLASS;
}
else if (!strcmp(type, "unsigned long int"))
{
if (sizeof(long int) == 4)
return mxUINT32_CLASS;
else
return mxUINT64_CLASS;
}
else if (!strcmp(type, "long long int"))
return mxINT64_CLASS;
else if (!strcmp(type, "unsigned long long int"))
return mxUINT64_CLASS;
else if (!strcmp(type, "float"))
return mxSINGLE_CLASS;
else if (!strcmp(type, "double"))
return mxDOUBLE_CLASS;
else if (!strcmp(type, "float complex"))
{
*complexity = mxCOMPLEX;
return mxSINGLE_CLASS;
}
else if (!strcmp(type, "double complex"))
{
*complexity = mxCOMPLEX;
return mxDOUBLE_CLASS;
}
else if (!strcmp(type, "string"))
return mxCHAR_CLASS;
else if (!strcmp(type, "string array"))
return mxCHAR_CLASS;

return 0; /* just to avoid warnings. never executed */
}

/* Reverse the order in an array in place.
use swapping from Matlab/Fortran/column-major order to
ADIOS-read-api/C/row-major order and back
Expand Down
2 changes: 1 addition & 1 deletion bindings/Python/py11IO.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ Attribute IO::InquireAttribute(const std::string &name)
{ \
attribute = m_IO->InquireAttribute<T>(name); \
}
ADIOS2_FOREACH_ATTRIBUTE_TYPE_1ARG(declare_template_instantiation)
ADIOS2_FOREACH_ATTRIBUTE_STDTYPE_1ARG(declare_template_instantiation)
#undef declare_template_instantiation

return Attribute(attribute);
Expand Down
50 changes: 3 additions & 47 deletions bindings/Python/py11types.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,57 +19,13 @@ namespace py11
{

#define ADIOS2_FOREACH_PYTHON_TYPE_1ARG(MACRO) \
MACRO(std::string) \
MACRO(char) \
MACRO(signed char) \
MACRO(unsigned char) \
MACRO(short) \
MACRO(unsigned short) \
MACRO(int) \
MACRO(unsigned int) \
MACRO(long int) \
MACRO(long long int) \
MACRO(unsigned long int) \
MACRO(unsigned long long int) \
MACRO(float) \
MACRO(double) \
MACRO(long double) \
MACRO(std::complex<float>) \
MACRO(std::complex<double>)
ADIOS2_FOREACH_STDTYPE_1ARG(MACRO)

#define ADIOS2_FOREACH_NUMPY_TYPE_1ARG(MACRO) \
MACRO(char) \
MACRO(signed char) \
MACRO(unsigned char) \
MACRO(short) \
MACRO(unsigned short) \
MACRO(int) \
MACRO(unsigned int) \
MACRO(long int) \
MACRO(long long int) \
MACRO(unsigned long int) \
MACRO(unsigned long long int) \
MACRO(float) \
MACRO(double) \
MACRO(long double) \
MACRO(std::complex<float>) \
MACRO(std::complex<double>)
ADIOS2_FOREACH_PRIMITIVE_STDTYPE_1ARG(MACRO)

#define ADIOS2_FOREACH_NUMPY_ATTRIBUTE_TYPE_1ARG(MACRO) \
MACRO(char) \
MACRO(signed char) \
MACRO(unsigned char) \
MACRO(short) \
MACRO(unsigned short) \
MACRO(int) \
MACRO(unsigned int) \
MACRO(long int) \
MACRO(long long int) \
MACRO(unsigned long int) \
MACRO(unsigned long long int) \
MACRO(float) \
MACRO(double) \
MACRO(long double)
ADIOS2_FOREACH_ATTRIBUTE_PRIMITIVE_STDTYPE_1ARG(MACRO)

} // end namespace py11
} // end namespace adios2
Expand Down
2 changes: 1 addition & 1 deletion examples/hello/datamanReader/DataManCallbackReceiver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ void UserCallBack(void *data, const std::string &doid, const std::string &var,
} \
std::cout << std::endl; \
}
ADIOS2_FOREACH_TYPE_1ARG(declare_type)
ADIOS2_FOREACH_STDTYPE_1ARG(declare_type)
#undef declare_type
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ ProcessMetadata(int rank, const adios2::Engine &reader, adios2::IO &io,
{ \
ProcessVariableMetadata<T>(rank, name, type, reader, io, varinfos); \
}
ADIOS2_FOREACH_TYPE_1ARG(declare_template_instantiation)
ADIOS2_FOREACH_STDTYPE_1ARG(declare_template_instantiation)
#undef declare_template_instantiation
}
#ifdef ADIOS2_HAVE_MPI
Expand Down
56 changes: 20 additions & 36 deletions source/adios2/ADIOSMacros.h
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@

/**
<pre>
The ADIOS_FOREACH_TYPE_2ARGS macro assumes the given argument is a macro
The ADIOS2_FOREACH_STDTYPE_2ARGS macro assumes the given argument is a macro
which takes two arguments, the first being a type, and the second being a
label for that type, i.e. std::complex<float> and CFloat.
Expand All @@ -188,7 +188,7 @@
For example:
#define declare_foo(T,L) virtual const T& foo ## L (std::string bar);
ADIOS_FOREACH_TYPE_2ARGS(declare_foo)
ADIOS2_FOREACH_STDTYPE_2ARGS(declare_foo)
#undef declare_foo
is equivalent to:
Expand All @@ -201,40 +201,24 @@
virtual std::complex<double>& foo_CDouble(std::string bar);
</pre>
*/
#define ADIOS2_FOREACH_TYPE_2ARGS(MACRO) \
MACRO(std::string, String) \
MACRO(char, Char) \
MACRO(signed char, SChar) \
MACRO(unsigned char, UChar) \
MACRO(short, Short) \
MACRO(unsigned short, UShort) \
MACRO(int, Int) \
MACRO(unsigned int, UInt) \
MACRO(long int, LInt) \
MACRO(long long int, LLInt) \
MACRO(unsigned long int, ULInt) \
MACRO(unsigned long long int, ULLInt) \
MACRO(float, Float) \
MACRO(double, Double) \
MACRO(long double, LDouble) \
MACRO(std::complex<float>, CFloat) \
MACRO(std::complex<double>, CDouble)

#define ADIOS2_FOREACH_PRIMITIVE_TYPE_2ARGS(MACRO) \
MACRO(char, Char) \
MACRO(signed char, Char) \
MACRO(unsigned char, UChar) \
MACRO(short, Short) \
MACRO(unsigned short, UShort) \
MACRO(int, Int) \
MACRO(unsigned int, UInt) \
MACRO(long int, LInt) \
MACRO(long long int, LLInt) \
MACRO(unsigned long int, ULInt) \
MACRO(unsigned long long int, ULLInt) \
MACRO(float, Float) \
MACRO(double, Double) \
MACRO(long double, LDouble)
#define ADIOS2_FOREACH_ATTRIBUTE_STDTYPE_2ARGS(MACRO) \
MACRO(std::string, string) \
MACRO(int8_t, int8) \
MACRO(uint8_t, uint8) \
MACRO(int16_t, int16) \
MACRO(uint16_t, uint16) \
MACRO(int32_t, int32) \
MACRO(uint32_t, uint32) \
MACRO(int64_t, int64) \
MACRO(uint64_t, uint64) \
MACRO(float, float) \
MACRO(double, double) \
MACRO(long double, ldouble)

#define ADIOS2_FOREACH_STDTYPE_2ARGS(MACRO) \
ADIOS2_FOREACH_ATTRIBUTE_STDTYPE_2ARGS(MACRO) \
MACRO(std::complex<float>, cfloat) \
MACRO(std::complex<double>, cdouble)

#define ADIOS2_FOREACH_COMPLEX_TYPE_2ARGS(MACRO) \
MACRO(std::complex<float>, CFloat) \
Expand Down
2 changes: 1 addition & 1 deletion source/adios2/core/ADIOS.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ Operator *ADIOS::InquireOperator(const std::string name) noexcept
return *itPair.first->second; \
}

ADIOS2_FOREACH_TYPE_1ARG(declare_type)
ADIOS2_FOREACH_STDTYPE_1ARG(declare_type)
#undef declare_type

Operator &ADIOS::DefineCallBack(
Expand Down
2 changes: 1 addition & 1 deletion source/adios2/core/ADIOS.h
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ class ADIOS
const Dims &)> &function, \
const Params &parameters);

ADIOS2_FOREACH_TYPE_1ARG(declare_type)
ADIOS2_FOREACH_STDTYPE_1ARG(declare_type)
#undef declare_type

/** define CallBack2 */
Expand Down
2 changes: 1 addition & 1 deletion source/adios2/core/Attribute.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ namespace core
{ \
}

ADIOS2_FOREACH_ATTRIBUTE_TYPE_1ARG(declare_type)
ADIOS2_FOREACH_ATTRIBUTE_STDTYPE_1ARG(declare_type)
#undef declare_type

} // end namespace core
Expand Down
8 changes: 4 additions & 4 deletions source/adios2/core/Engine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ void Engine::InitTransports() {}
{ \
ThrowUp("DoPutDeferred"); \
}
ADIOS2_FOREACH_TYPE_1ARG(declare_type)
ADIOS2_FOREACH_STDTYPE_1ARG(declare_type)
#undef declare_type

// DoGet*
Expand All @@ -105,7 +105,7 @@ ADIOS2_FOREACH_TYPE_1ARG(declare_type)
return nullptr; \
}

ADIOS2_FOREACH_TYPE_1ARG(declare_type)
ADIOS2_FOREACH_STDTYPE_1ARG(declare_type)
#undef declare_type

#define declare_type(T) \
Expand All @@ -130,7 +130,7 @@ ADIOS2_FOREACH_TYPE_1ARG(declare_type)
return std::vector<typename Variable<T>::Info>(); \
}

ADIOS2_FOREACH_TYPE_1ARG(declare_type)
ADIOS2_FOREACH_STDTYPE_1ARG(declare_type)
#undef declare_type

// PRIVATE
Expand Down Expand Up @@ -187,7 +187,7 @@ void Engine::CheckOpenModes(const std::set<Mode> &modes,
template std::vector<typename Variable<T>::Info> Engine::BlocksInfo( \
const Variable<T> &, const size_t) const;

ADIOS2_FOREACH_TYPE_1ARG(declare_template_instantiation)
ADIOS2_FOREACH_STDTYPE_1ARG(declare_template_instantiation)
#undef declare_template_instantiation

} // end namespace core
Expand Down
8 changes: 4 additions & 4 deletions source/adios2/core/Engine.h
Original file line number Diff line number Diff line change
Expand Up @@ -437,15 +437,15 @@ class Engine
#define declare_type(T) \
virtual void DoPutSync(Variable<T> &, const T *); \
virtual void DoPutDeferred(Variable<T> &, const T *);
ADIOS2_FOREACH_TYPE_1ARG(declare_type)
ADIOS2_FOREACH_STDTYPE_1ARG(declare_type)
#undef declare_type

// Get
#define declare_type(T) \
virtual void DoGetSync(Variable<T> &, T *); \
virtual void DoGetDeferred(Variable<T> &, T *); \
virtual typename Variable<T>::Info *DoGetBlockSync(Variable<T> &);
ADIOS2_FOREACH_TYPE_1ARG(declare_type)
ADIOS2_FOREACH_STDTYPE_1ARG(declare_type)
#undef declare_type

virtual void DoClose(const int transportIndex) = 0;
Expand All @@ -471,7 +471,7 @@ class Engine
virtual std::vector<typename Variable<T>::Info> DoBlocksInfo( \
const Variable<T> &variable, const size_t step) const;

ADIOS2_FOREACH_TYPE_1ARG(declare_type)
ADIOS2_FOREACH_STDTYPE_1ARG(declare_type)
#undef declare_type

private:
Expand Down Expand Up @@ -539,7 +539,7 @@ class Engine
extern template std::vector<typename Variable<T>::Info> \
Engine::BlocksInfo(const Variable<T> &, const size_t) const;

ADIOS2_FOREACH_TYPE_1ARG(declare_template_instantiation)
ADIOS2_FOREACH_STDTYPE_1ARG(declare_template_instantiation)
#undef declare_template_instantiation

} // end namespace core
Expand Down
Loading

0 comments on commit 8d5e22a

Please sign in to comment.