Skip to content

amrex::FileStream #4550

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

Draft
wants to merge 12 commits into
base: development
Choose a base branch
from
Draft
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
92 changes: 48 additions & 44 deletions Docs/sphinx_documentation/source/BuildingAMReX.rst
Original file line number Diff line number Diff line change
Expand Up @@ -28,50 +28,52 @@ list of important variables.

.. table:: Important make variables

+-----------------+-------------------------------------+--------------------+
| Variable | Value | Default |
+=================+=====================================+====================+
| AMREX_HOME | Path to amrex | environment |
+-----------------+-------------------------------------+--------------------+
| COMP | gnu, cray, ibm, intel, intel-llvm, | |
| | intel-classic, llvm, or pgi | none |
+-----------------+-------------------------------------+--------------------+
| CXXSTD | C++ standard (``c++17``, ``c++20``) | compiler default, |
| | | at least ``c++17`` |
+-----------------+-------------------------------------+--------------------+
| DEBUG | TRUE or FALSE | FALSE |
+-----------------+-------------------------------------+--------------------+
| DIM | 1 or 2 or 3 | 3 |
+-----------------+-------------------------------------+--------------------+
| PRECISION | DOUBLE or FLOAT | DOUBLE |
+-----------------+-------------------------------------+--------------------+
| TEST | TRUE or FALSE | FALSE |
+-----------------+-------------------------------------+--------------------+
| USE_ASSERTION | TRUE or FALSE | FALSE |
+-----------------+-------------------------------------+--------------------+
| USE_MPI | TRUE or FALSE | FALSE |
+-----------------+-------------------------------------+--------------------+
| USE_OMP | TRUE or FALSE | FALSE |
+-----------------+-------------------------------------+--------------------+
| USE_CUDA | TRUE or FALSE | FALSE |
+-----------------+-------------------------------------+--------------------+
| USE_HIP | TRUE or FALSE | FALSE |
+-----------------+-------------------------------------+--------------------+
| USE_SYCL | TRUE or FALSE | FALSE |
+-----------------+-------------------------------------+--------------------+
| USE_RPATH | TRUE or FALSE | FALSE |
+-----------------+-------------------------------------+--------------------+
| WARN_ALL | TRUE or FALSE | TRUE for DEBUG |
| | | FALSE otherwise |
+-----------------+-------------------------------------+--------------------+
| AMREX_CUDA_ARCH | CUDA arch such as 70 | 70 if not set |
| or CUDA_ARCH | | or detected |
+-----------------+-------------------------------------+--------------------+
| AMREX_AMD_ARCH | AMD GPU arch such as gfx908 | none if the |
| or AMD_ARCH | | machine is unknown |
+-----------------+-------------------------------------+--------------------+
| USE_GPU_RDC | TRUE or FALSE | TRUE |
+-----------------+-------------------------------------+--------------------+
+---------------------+-------------------------------------+--------------------+
| Variable | Value | Default |
+=====================+=====================================+====================+
| AMREX_HOME | Path to amrex | environment |
+---------------------+-------------------------------------+--------------------+
| COMP | gnu, cray, ibm, intel, intel-llvm, | |
| | intel-classic, llvm, or pgi | none |
+---------------------+-------------------------------------+--------------------+
| CXXSTD | C++ standard (``c++17``, ``c++20``) | compiler default, |
| | | at least ``c++17`` |
+---------------------+-------------------------------------+--------------------+
| DEBUG | TRUE or FALSE | FALSE |
+---------------------+-------------------------------------+--------------------+
| DIM | 1 or 2 or 3 | 3 |
+---------------------+-------------------------------------+--------------------+
| PRECISION | DOUBLE or FLOAT | DOUBLE |
+---------------------+-------------------------------------+--------------------+
| TEST | TRUE or FALSE | FALSE |
+---------------------+-------------------------------------+--------------------+
| USE_ASSERTION | TRUE or FALSE | FALSE |
+---------------------+-------------------------------------+--------------------+
| USE_MPI | TRUE or FALSE | FALSE |
+---------------------+-------------------------------------+--------------------+
| USE_OMP | TRUE or FALSE | FALSE |
+---------------------+-------------------------------------+--------------------+
| USE_CUDA | TRUE or FALSE | FALSE |
+---------------------+-------------------------------------+--------------------+
| USE_HIP | TRUE or FALSE | FALSE |
+---------------------+-------------------------------------+--------------------+
| USE_SYCL | TRUE or FALSE | FALSE |
+---------------------+-------------------------------------+--------------------+
| USE_RPATH | TRUE or FALSE | FALSE |
+---------------------+-------------------------------------+--------------------+
| WARN_ALL | TRUE or FALSE | TRUE for DEBUG |
| | | FALSE otherwise |
+---------------------+-------------------------------------+--------------------+
| AMREX_CUDA_ARCH | CUDA arch such as 70 | 70 if not set |
| or CUDA_ARCH | | or detected |
+---------------------+-------------------------------------+--------------------+
| AMREX_AMD_ARCH | AMD GPU arch such as gfx908 | none if the |
| or AMD_ARCH | | machine is unknown |
+---------------------+-------------------------------------+--------------------+
| USE_GPU_RDC | TRUE or FALSE | TRUE |
+---------------------+-------------------------------------+--------------------+
| USE_OWN_FILE_STREAM | TRUE or FALSE | FALSE |
+---------------------+-------------------------------------+--------------------+


.. raw:: latex
Expand Down Expand Up @@ -551,6 +553,8 @@ The list of available options is reported in the :ref:`table <tab:cmakevar>` bel
| AMReX_INLINE_LIMIT | Inline limit. Relevant only when | 43210 | Non-negative number |
| | AMReX_COMPILER_DEFAULT_INLINE is NO. | | |
+------------------------------+-------------------------------------------------+-------------------------+-----------------------+
| AMReX_OWN_FILE_STREAM | Use AMReX's own file stream in I/O | NO | YES, NO |
+------------------------------+-------------------------------------------------+-------------------------+-----------------------+
.. raw:: latex

\end{center}
Expand Down
2 changes: 1 addition & 1 deletion Src/Base/AMReX.H
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ namespace amrex
//! Print out message to cerr and exit via amrex::Abort().
void Error (const std::string& msg);

void Error_host (const char* type, const char* msg);
void Error_host (const char* type, const char* msg, bool can_throw = true);

AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
void Error (const char* msg = nullptr) {
Expand Down
4 changes: 2 additions & 2 deletions Src/Base/AMReX.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -239,15 +239,15 @@ amrex::Warning (const std::string& msg)
}

void
amrex::Error_host (const char* type, const char * msg)
amrex::Error_host (const char* type, const char * msg, bool can_throw)
{
amrex::ignore_unused(type);
#ifdef AMREX_USE_COVERITY
amrex_coverity_abort();
#else
if (system::error_handler) {
system::error_handler(msg);
} else if (system::throw_exception) {
} else if (system::throw_exception && can_throw) {
throw RuntimeError(msg);
} else {
write_lib_id(type);
Expand Down
37 changes: 37 additions & 0 deletions Src/Base/AMReX_FabConv.H
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#include <AMReX_BLassert.H>
#include <AMReX_REAL.H>
#include <AMReX_INT.H>
#include <AMReX_FileStream.H>

#include <iosfwd>

Expand Down Expand Up @@ -182,6 +183,12 @@ public:
Long nitems,
std::istream& is,
const RealDescriptor& id);
#ifndef _WIN32
static void convertToNativeFormat (Real* out,
Long nitems,
amrex::FileStream& is,
const RealDescriptor& id);
#endif

/**
* \brief Convert nitems Reals in native format to RealDescriptor format
Expand All @@ -191,6 +198,12 @@ public:
Long nitems,
const Real* in,
const RealDescriptor& od);
#ifndef _WIN32
static void convertFromNativeFormat (amrex::FileStream& os,
Long nitems,
const Real* in,
const RealDescriptor& od);
#endif
/**
* \brief Convert nitems Reals in native format to RealDescriptor format.
* The out array is assumed to be large enough to hold the
Expand All @@ -209,6 +222,12 @@ public:
Long nitems,
const float* in,
const RealDescriptor& od);
#ifndef _WIN32
static void convertFromNativeFloatFormat (amrex::FileStream& os,
Long nitems,
const float* in,
const RealDescriptor& od);
#endif

/**
* \brief Convert nitems doubles in native format to RealDescriptor format
Expand All @@ -218,6 +237,12 @@ public:
Long nitems,
const double* in,
const RealDescriptor& od);
#ifndef _WIN32
static void convertFromNativeDoubleFormat (amrex::FileStream& os,
Long nitems,
const double* in,
const RealDescriptor& od);
#endif

/**
* \brief Read nitems from istream in RealDescriptor format and
Expand All @@ -228,6 +253,12 @@ public:
Long nitems,
std::istream& is,
const RealDescriptor& id);
#ifndef _WIN32
static void convertToNativeFloatFormat (float* out,
Long nitems,
amrex::FileStream& is,
const RealDescriptor& id);
#endif

/**
* \brief Read nitems from istream in RealDescriptor format and
Expand All @@ -238,6 +269,12 @@ public:
Long nitems,
std::istream& is,
const RealDescriptor& id);
#ifndef _WIN32
static void convertToNativeDoubleFormat (double* out,
Long nitems,
amrex::FileStream& is,
const RealDescriptor& id);
#endif

private:

Expand Down
Loading
Loading