Preconditioner: optionally instantiate for float

BILU0: optionally instantiate for float
BISAI: optionally instantiate for float
CPR: optionally instantiate for float
CPRCreation: optionally instantiate for float
Misc: optionally instantiate for float
This commit is contained in:
Arne Morten Kvarving 2024-04-16 14:31:09 +02:00
parent 5bab71b8e3
commit a0f8cc0aed
6 changed files with 40 additions and 12 deletions

View File

@ -284,7 +284,7 @@ analyzeAggregateMaps()
}
}
#define INSTANCE_TYPE(T) \
#define INSTANTIATE_TYPE(T) \
template class CprCreation<T,1>; \
template class CprCreation<T,2>; \
template class CprCreation<T,3>; \
@ -292,7 +292,11 @@ analyzeAggregateMaps()
template class CprCreation<T,5>; \
template class CprCreation<T,6>;
INSTANCE_TYPE(double)
INSTANTIATE_TYPE(double)
#if FLOW_INSTANTIATE_FLOAT
INSTANTIATE_TYPE(float)
#endif
} // namespace Opm

View File

@ -1,8 +1,10 @@
#include <cmath>
#include <algorithm>
#include <config.h>
#include <opm/simulators/linalg/bda/Misc.hpp>
#include <cmath>
#include <algorithm>
namespace Opm::Accelerator {
// divide A by B, and round up: return (int)ceil(A/B)
@ -59,4 +61,8 @@ void solve_transposed_3x3(const Scalar* A,
INSTANTIATE_TYPE(double)
#if FLOW_INSTANTIATE_FLOAT
INSTANTIATE_TYPE(float)
#endif
}

View File

@ -333,7 +333,7 @@ void openclBILU0<Scalar,block_size>::apply(const cl::Buffer& y, cl::Buffer& x)
}
}
#define INSTANCE_TYPE(T) \
#define INSTANTIATE_TYPE(T) \
template class openclBILU0<T,1>; \
template class openclBILU0<T,2>; \
template class openclBILU0<T,3>; \
@ -341,6 +341,10 @@ void openclBILU0<Scalar,block_size>::apply(const cl::Buffer& y, cl::Buffer& x)
template class openclBILU0<T,5>; \
template class openclBILU0<T,6>;
INSTANCE_TYPE(double)
INSTANTIATE_TYPE(double)
#if FLOW_INSTANTIATE_FLOAT
INSTANTIATE_TYPE(float)
#endif
} // namespace Opm::Accelerator

View File

@ -353,7 +353,7 @@ void openclBISAI<Scalar,block_size>::apply(const cl::Buffer& x, cl::Buffer& y)
d_invL_x, y, Nb, bs); // application of isaiU is a simple spmv
}
#define INSTANCE_TYPE(T) \
#define INSTANTIATE_TYPE(T) \
template class openclBISAI<T,1>; \
template class openclBISAI<T,2>; \
template class openclBISAI<T,3>; \
@ -361,6 +361,10 @@ void openclBISAI<Scalar,block_size>::apply(const cl::Buffer& x, cl::Buffer& y)
template class openclBISAI<T,5>; \
template class openclBISAI<T,6>;
INSTANCE_TYPE(double)
INSTANTIATE_TYPE(double)
#if FLOW_INSTANTIATE_FLOAT
INSTANTIATE_TYPE(float)
#endif
} // namespace Opm::Accelerator

View File

@ -36,6 +36,8 @@
#include <opm/simulators/linalg/bda/Misc.hpp>
#include <type_traits>
namespace Opm::Accelerator {
using Dune::Timer;
@ -312,7 +314,7 @@ void openclCPR<Scalar,block_size>::apply(const cl::Buffer& y, cl::Buffer& x)
}
}
#define INSTANCE_TYPE(T) \
#define INSTANTIATE_TYPE(T) \
template class openclCPR<T,1>; \
template class openclCPR<T,2>; \
template class openclCPR<T,3>; \
@ -320,6 +322,10 @@ void openclCPR<Scalar,block_size>::apply(const cl::Buffer& y, cl::Buffer& x)
template class openclCPR<T,5>; \
template class openclCPR<T,6>;
INSTANCE_TYPE(double)
INSTANTIATE_TYPE(double)
#if FLOW_INSTANTIATE_FLOAT
INSTANTIATE_TYPE(float)
#endif
} // namespace Opm::Accelerator

View File

@ -61,7 +61,7 @@ setOpencl(std::shared_ptr<cl::Context>& context_,
queue = queue_;
}
#define INSTANCE_TYPE(T) \
#define INSTANTIATE_TYPE(T) \
template class openclPreconditioner<T,1>; \
template class openclPreconditioner<T,2>; \
template class openclPreconditioner<T,3>; \
@ -69,6 +69,10 @@ setOpencl(std::shared_ptr<cl::Context>& context_,
template class openclPreconditioner<T,5>; \
template class openclPreconditioner<T,6>;
INSTANCE_TYPE(double)
INSTANTIATE_TYPE(double)
#if FLOW_INSTANTIATE_FLOAT
INSTANTIATE_TYPE(float)
#endif
} // namespace Opm::Accelerator