2 #ifndef INMOST_COMMON_INCLUDED
3 #define INMOST_COMMON_INCLUDED
6 #include "inmost_options.h"
7 #if !defined(INMOST_OPTIONS_CMAKE_INCLUDED)
8 #pragma message("CMake options are not used")
15 #define USE_PARTITIONER
57 #define USE_PARALLEL_STORAGE
83 #define __INLINE inline
90 #define OMPI_SKIP_MPICXX 1
92 #if !defined(MSMPI_VER) && !defined(MPIO_INCLUDE) && defined(USE_MPI_FILE) && !defined(OMPI_PROVIDE_MPI_FILE_INTERFACE)
97 #if defined(USE_OPENCL)
99 #include "OpenCL/opencl.h"
120 #define OMP_THREAD omp_get_thread_num()
121 #define MAX_THREADS omp_get_max_threads()
124 #define MAX_THREADS 1
135 #if !defined(USE_MPI)
136 #define INMOST_MPI_Request int
137 #define INMOST_MPI_Type int
138 #define INMOST_MPI_Comm int
139 #define INMOST_MPI_Group int
140 #define INMOST_MPI_COMM_WORLD 0
141 #define INMOST_MPI_COMM_SELF 0
142 #define INMOST_MPI_BYTE 0
143 #define INMOST_MPI_INT 0
144 #define INMOST_MPI_INT64_T 0
145 #define INMOST_MPI_UINT64_T 0
146 #define INMOST_MPI_DOUBLE 0
147 #define INMOST_MPI_FLOAT 0
148 #define INMOST_MPI_UNSIGNED 0
149 #define INMOST_MPI_UNSIGNEDL 0
150 #define INMOST_MPI_UNSIGNEDLL 0
151 #define INMOST_MPI_Win int
152 #define INMOST_MPI_DATATYPE_NULL 0
153 #define INMOST_MPI_GROUP_EMPTY 0
155 #define INMOST_MPI_Request MPI_Request
156 #define INMOST_MPI_Type MPI_Datatype
157 #define INMOST_MPI_Comm MPI_Comm
158 #define INMOST_MPI_Group MPI_Group
159 #define INMOST_MPI_COMM_WORLD MPI_COMM_WORLD
160 #define INMOST_MPI_COMM_SELF MPI_COMM_SELF
161 #define INMOST_MPI_BYTE MPI_BYTE
162 #define INMOST_MPI_INT MPI_INT
163 #define INMOST_MPI_INT64_T MPI_INT64_T
164 #define INMOST_MPI_UINT64_T MPI_UINT64_T
165 #define INMOST_MPI_DOUBLE MPI_DOUBLE
166 #define INMOST_MPI_FLOAT MPI_FLOAT
167 #define INMOST_MPI_UNSIGNED MPI_UNSIGNED
168 #define INMOST_MPI_UNSIGNEDL MPI_UNSIGNED_LONG
169 #define INMOST_MPI_UNSIGNEDLL MPI_UNSIGNED_LONG_LONG
170 #define INMOST_MPI_Win MPI_Win
171 #define INMOST_MPI_DATATYPE_NULL MPI_DATATYPE_NULL
172 #define INMOST_MPI_GROUP_EMPTY MPI_GROUP_EMPTY
175 #if !defined(USE_OMP)
176 #define INMOST_OMP_LOCK_T int
178 #define INMOST_OMP_LOCK_T omp_lock_t
182 #define INMOST_MPI_SIZE int
184 #define INMOST_DATA_BULK_TYPE unsigned char
185 #define INMOST_MPI_DATA_BULK_TYPE INMOST_MPI_BYTE
187 #if defined(USE_FP64)
188 #define INMOST_DATA_REAL_TYPE double
189 #define INMOST_MPI_DATA_REAL_TYPE INMOST_MPI_DOUBLE
190 #define INMOST_DATA_CPLX_TYPE std::complex<double>
192 #define INMOST_DATA_REAL_TYPE float
193 #define INMOST_MPI_DATA_REAL_TYPE INMOST_MPI_FLOAT
194 #define INMOST_DATA_CPLX_TYPE std::complex<float>
197 __INLINE
static INMOST_DATA_REAL_TYPE fabs(
const INMOST_DATA_CPLX_TYPE & Arg) {
return std::abs(Arg); }
198 __INLINE
static INMOST_DATA_REAL_TYPE conj(INMOST_DATA_REAL_TYPE Arg) {
return Arg; }
200 #if defined(USE_INT64)
201 #define INMOST_DATA_INTEGER_TYPE int64_t
202 #define INMOST_DATA_ENUM_TYPE uint64_t
203 #define INMOST_DATA_BIG_ENUM_TYPE uint64_t
206 #define UINT64_MAX ULLONG_MAX
209 #define ENUMUNDEF UINT64_MAX
210 #define BIGENUMUNDEF UINT64_MAX
213 #define INMOST_MPI_DATA_INTEGER_TYPE INMOST_MPI_INT64_T
214 #define INMOST_MPI_DATA_ENUM_TYPE INMOST_MPI_UINT64_T
215 #define INMOST_MPI_DATA_BIG_ENUM_TYPE INMOST_MPI_UINT64_T
217 #define INMOST_DATA_INTEGER_TYPE int
218 #define INMOST_DATA_ENUM_TYPE unsigned int
219 #define INMOST_DATA_BIG_ENUM_TYPE unsigned long long
221 #define ENUMUNDEF UINT_MAX
222 #define BIGENUMUNDEF ULLONG_MAX
224 #define INMOST_MPI_DATA_INTEGER_TYPE INMOST_MPI_INT
225 #define INMOST_MPI_DATA_ENUM_TYPE INMOST_MPI_UNSIGNED
226 #define INMOST_MPI_DATA_BIG_ENUM_TYPE INMOST_MPI_UNSIGNEDLL
268 ElementBelongsToNobody,
276 UndefinedBehaviorInGeometry,
277 DimensionIsNotSupportedByGeometry,
284 DataCorruptedInSolver,
285 DifferentCommunicatorInSolver,
286 MatrixNotSetInSolver,
287 InconsistentSizesInSolver,
288 IndexesAreDifferentInSolver,
290 CannotReusePreconditionerOfDifferentSize,
292 SolverUnsupportedOperation,
293 SolverUnknownParameter,
294 SolverNonExistentParameters,
295 SolverCopyNullException,
297 SolverAssignNullException,
298 SolverAssignException,
301 ErrorInPartitioner = 500,
303 DistributionTagWasNotFilled,
307 MatrixCholeskySolveFail,
309 MatrixPseudoSolveFail,
312 NotImplemented = 1000,
317 #include "container.hpp"
323 template<
typename Var>
324 class AbstractMatrixReadOnly;
326 template<
typename Var>
327 class AbstractMatrix;
329 template<
typename Var>
332 template<
typename Var>
335 template<
typename Var>
338 template<
typename Var>
341 template<
typename Var>
342 class ConstMatrixRepack;
344 template<
typename Var>
347 template<
typename Var>
350 template<
typename Var>
351 class ConstSubMatrix;
353 template<
typename Var>
356 template<
typename Var>
357 class ConstBlockOfMatrix;
359 template<
typename Var>
360 class MatrixConcatRows;
362 template<
typename Var>
363 class ConstMatrixConcatRows;
365 template<
typename VarA,
typename VarB,
typename VarR>
366 class ConstMatrixConcatRows2;
368 template<
typename Var>
369 class MatrixConcatCols;
371 template<
typename Var>
372 class ConstMatrixConcatCols;
374 template<
typename VarA,
typename VarB,
typename VarR>
375 class ConstMatrixConcatCols2;
377 template<
typename Var>
378 class MatrixUnaryMinus;
380 template<
typename VarA,
typename VarB>
383 template<
typename VarA,
typename VarB>
384 class MatrixDifference;
386 template<
typename Var>
387 class MatrixTranspose;
389 template<
typename Var>
390 class ConstMatrixTranspose;
392 template<
typename Var>
393 class ConstMatrixConjugate;
395 template<
typename Var>
396 class ConstMatrixConjugateTranspose;
398 template<
typename VarA,
typename VarB>
399 class KroneckerProduct;
401 template<
typename VarA,
typename VarB,
typename VarR>
404 template<
typename VarA,
typename VarB,
typename VarR>
407 template<
typename VarA,
typename VarB,
typename VarR>
408 class MatrixMulShellCoef;
410 template<
typename VarA,
typename VarB,
typename VarR>
411 class MatrixDivShellCoef;
413 template<
typename VarA,
typename VarB,
typename VarR>
416 template<
typename Var,
typename Storage = std::vector<Var> >
419 template<
typename Var,
typename Storage = std::vector<Var> >
420 class SymmetricMatrix;
422 class value_reference;
427 __INLINE
bool __isnan__(
double x) {
return x != x; }
428 __INLINE
bool __isinf__(
double x) {
return fabs(x) > DBL_MAX; }
429 __INLINE
bool __isbad(
double x) {
return __isnan__(x) || __isinf__(x); }
433 size_t getCurrentRSS();