Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Kirill Terekhov
INMOST
Commits
d4bc436b
Commit
d4bc436b
authored
Feb 15, 2021
by
Kirill Terekhov
Browse files
prepare switch for 64-bit integer indexes
parent
bdc7a7e5
Changes
10
Hide whitespace changes
Inline
Side-by-side
CMakeLists.txt
View file @
d4bc436b
...
...
@@ -18,6 +18,9 @@ option(USE_MPI2 "Use MPI-2 extensions, useful if your MPI library warns you to u
option
(
USE_OMP
"Compile with OpenMP support (experimental)"
OFF
)
option
(
USE_OPENCL
"Use OpenCL where possible (experimental)"
OFF
)
option
(
USE_INT64
"Use 64-bit integer types (use for large problems)"
OFF
)
option
(
USE_FP64
"Use 64-bit floating-point types (usually on)"
ON
)
option
(
USE_MESH
"Compile mesh capabilities"
ON
)
option
(
USE_SOLVER
"Compile solver capabilities"
ON
)
option
(
USE_PARTITIONER
"Compile partitioner capabilities"
ON
)
...
...
Source/Headers/inmost_common.h
View file @
d4bc436b
...
...
@@ -36,6 +36,9 @@
//#define USE_MPI_P2P //use (probably) more effective mpi-2 algorithms
//#define USE_MPI_FILE //use MPI_File_xxx functionality
//#define USE_MPI2 //set of your version produce warnings
//#define USE_INT64
#define USE_FP64
#endif //INMOST_OPTIONS_CMAKE_INCLUDED
...
...
@@ -132,10 +135,13 @@
#define INMOST_MPI_Comm int
#define INMOST_MPI_Group int
#define INMOST_MPI_COMM_WORLD 0
#define INMOST_MPI_COMM_SELF 0
#define INMOST_MPI_COMM_SELF
0
#define INMOST_MPI_BYTE 0
#define INMOST_MPI_INT 0
#define INMOST_MPI_INT64_T 0
#define INMOST_MPI_UINT64_T 0
#define INMOST_MPI_DOUBLE 0
#define INMOST_MPI_FLOAT 0
#define INMOST_MPI_UNSIGNED 0
#define INMOST_MPI_UNSIGNEDL 0
#define INMOST_MPI_UNSIGNEDLL 0
...
...
@@ -151,7 +157,10 @@
#define INMOST_MPI_COMM_SELF MPI_COMM_SELF
#define INMOST_MPI_BYTE MPI_BYTE
#define INMOST_MPI_INT MPI_INT
#define INMOST_MPI_INT64_T MPI_INT64_T
#define INMOST_MPI_UINT64_T MPI_UINT64_T
#define INMOST_MPI_DOUBLE MPI_DOUBLE
#define INMOST_MPI_FLOAT MPI_FLOAT
#define INMOST_MPI_UNSIGNED MPI_UNSIGNED
#define INMOST_MPI_UNSIGNEDL MPI_UNSIGNED_LONG
#define INMOST_MPI_UNSIGNEDLL MPI_UNSIGNED_LONG_LONG
...
...
@@ -169,24 +178,45 @@
#define INMOST_MPI_SIZE int //in case MPI standard changes and compiler gives tons of warnings
#define INMOST_DATA_INTEGER_TYPE int
#define INMOST_DATA_REAL_TYPE double
#define INMOST_DATA_BULK_TYPE unsigned char //this should be one byte long
#define INMOST_MPI_DATA_BULK_TYPE INMOST_MPI_BYTE
#define INMOST_MPI_DATA_INTEGER_TYPE INMOST_MPI_INT
#if defined(USE_FP64)
#define INMOST_DATA_REAL_TYPE double
#define INMOST_MPI_DATA_REAL_TYPE INMOST_MPI_DOUBLE
#define INMOST_MPI_DATA_BULK_TYPE INMOST_MPI_BYTE
#else //USE_FP64
#define INMOST_DATA_REAL_TYPE float
#define INMOST_MPI_DATA_REAL_TYPE INMOST_MPI_FLOAT
#endif //USE_FP64
#if defined(USE_INT64)
#define INMOST_DATA_INTEGER_TYPE int64_t
#define INMOST_DATA_ENUM_TYPE uint64_t
#define INMOST_DATA_BIG_ENUM_TYPE uint64_t
#ifndef UINT64_MAX
#define UINT64_MAX ULLONG_MAX
#endif //UINT64_MAX
#define ENUMUNDEF UINT64_MAX
#define BIGENUMUNDEF UINT64_MAX
#define INMOST_MPI_DATA_INTEGER_TYPE INMOST_MPI_INT64_T
#define INMOST_MPI_DATA_ENUM_TYPE INMOST_MPI_UINT64_T
#define INMOST_MPI_DATA_BIG_ENUM_TYPE INMOST_MPI_UINT64_T
#else //USE_INT64
#define INMOST_DATA_INTEGER_TYPE int
#define INMOST_DATA_ENUM_TYPE unsigned int
#define ENUMUNDEF UINT_MAX
#define INMOST_DATA_BIG_ENUM_TYPE unsigned long long
#define BIGENUMUNDEF ULLONG_MAX
#define ENUMUNDEF UINT_MAX
#define BIGENUMUNDEF ULLONG_MAX
#define INMOST_MPI_DATA_INTEGER_TYPE INMOST_MPI_INT
#define INMOST_MPI_DATA_ENUM_TYPE INMOST_MPI_UNSIGNED
#define INMOST_MPI_DATA_BIG_ENUM_TYPE INMOST_MPI_UNSIGNEDLL
#endif //USE_INT64
/// Cross-platform timer that return current time in seconds.
/// The timer is similar to MPI_Wtime() and omp_get_wtime() but is independent on both flags USE_MPI and USE_OMP.
...
...
Source/Headers/inmost_data.h
View file @
d4bc436b
...
...
@@ -65,7 +65,7 @@ namespace INMOST
/// Number of chars to hold all private markers, total number (MarkerFields * bits_per_char).
static
const
INMOST_DATA_ENUM_TYPE
MarkerFieldsPrivate
=
4
;
/// Last bit indicate whether the marker is private.
static
const
INMOST_DATA_ENUM_TYPE
MarkerPrivateBit
=
1
<<
(
sizeof
(
INMOST_DATA_ENUM_TYPE
)
*
8
-
1
);
static
const
INMOST_DATA_ENUM_TYPE
MarkerPrivateBit
=
static_cast
<
INMOST_DATA_ENUM_TYPE
>
(
1
)
<<
(
sizeof
(
INMOST_DATA_ENUM_TYPE
)
*
8
-
1
);
/// Bit mask to obtain marker mask within MarkerType.
static
const
INMOST_DATA_ENUM_TYPE
MarkerMask
=
static_cast
<
INMOST_DATA_BULK_TYPE
>
(
-
1
);
/// sizeof(char) * bits_per_char.
...
...
@@ -80,7 +80,7 @@ namespace INMOST
typedef
INMOST_DATA_ENUM_TYPE
HandleType
;
static
const
INMOST_DATA_ENUM_TYPE
handle_etype_bits
=
3
;
static
const
INMOST_DATA_ENUM_TYPE
handle_etype_shift
=
sizeof
(
HandleType
)
*
8
-
handle_etype_bits
;
static
const
INMOST_DATA_ENUM_TYPE
handle_id_mask
=
(
1
<<
handle_etype_shift
)
-
1
;
static
const
INMOST_DATA_ENUM_TYPE
handle_id_mask
=
(
static_cast
<
INMOST_DATA_ENUM_TYPE
>
(
1
)
<<
handle_etype_shift
)
-
1
;
static
const
INMOST_DATA_ENUM_TYPE
chunk_bits_elems
=
13
;
static
const
INMOST_DATA_ENUM_TYPE
chunk_bits_empty
=
8
;
...
...
Source/Headers/inmost_mesh.h
View file @
d4bc436b
...
...
@@ -2858,6 +2858,13 @@ namespace INMOST
/// @param input Value on current processor
/// @return Sum over all processors
real
Integrate
(
real
input
);
/// Integrate unsigned integer value over all processors.
///
/// Collective operation.
///
/// @param input Value on current processor
/// @return Sum over all processors
enumerator
Integrate
(
enumerator
input
);
/// Integrate integer value over all processors.
///
/// Collective operation.
...
...
@@ -2873,6 +2880,14 @@ namespace INMOST
/// @param size Size of the array.
/// @return sum over all processors.
void
Integrate
(
real
*
input
,
integer
size
);
/// Integrate an array of unsigned integer values over all processors.
///
/// Collective operation.
///
/// @param input An array of values on current processor.
/// @param size Size of the array.
/// @return Sum over all processors.
void
Integrate
(
enumerator
*
input
,
integer
size
);
/// Integrate an array of integer values over all processors.
///
/// Collective operation.
...
...
Source/Headers/inmost_options_cmake.h
View file @
d4bc436b
...
...
@@ -37,5 +37,7 @@
#cmakedefine USE_MPI_FILE //use functionality for parallel files
#cmakedefine USE_MPI2 //use mpi-2 extensions
#cmakedefine USE_INT64 // switch to 64-bit integer types
#cmakedefine USE_FP64 // switch to 64-bit floating-point types (usually on)
#endif //INMOST_OPTIONS_CMAKE_INCLUDED
Source/IO/mesh_ecl_file.cpp
View file @
d4bc436b
...
...
@@ -2825,11 +2825,11 @@ namespace INMOST
int
numnode
=
0
;
for
(
int
i
=
0
;
i
<
dims
[
0
]
+
1
;
i
++
)
{
Storage
::
integer
pif
=
std
::
min
(
dims
[
0
]
-
1
,
i
),
pib
=
std
::
max
(
i
-
1
,
0
);
Storage
::
integer
pif
=
std
::
min
<
Storage
::
integer
>
(
dims
[
0
]
-
1
,
i
),
pib
=
std
::
max
(
i
-
1
,
0
);
y
=
0.0
;
for
(
int
j
=
0
;
j
<
dims
[
1
]
+
1
;
j
++
)
{
Storage
::
integer
pjf
=
std
::
min
(
dims
[
1
]
-
1
,
j
),
pjb
=
std
::
max
(
j
-
1
,
0
);
Storage
::
integer
pjf
=
std
::
min
<
Storage
::
integer
>
(
dims
[
1
]
-
1
,
j
),
pjb
=
std
::
max
(
j
-
1
,
0
);
z
=
(
tops
[
ECL_IJK_DATA
(
pib
,
pjb
,
0
)]
+
tops
[
ECL_IJK_DATA
(
pib
,
pjf
,
0
)]
+
...
...
@@ -2844,7 +2844,7 @@ namespace INMOST
)
*
0.25
;
for
(
int
k
=
0
;
k
<
dims
[
2
]
+
1
;
k
++
)
{
Storage
::
integer
pkf
=
std
::
min
(
dims
[
2
]
-
1
,
k
),
pkb
=
std
::
max
(
k
-
1
,
0
);
Storage
::
integer
pkf
=
std
::
min
<
Storage
::
integer
>
(
dims
[
2
]
-
1
,
k
),
pkb
=
std
::
max
(
k
-
1
,
0
);
bool
create
=
true
;
if
(
!
actnum
.
empty
())
{
...
...
Source/Mesh/iterator.cpp
View file @
d4bc436b
...
...
@@ -233,7 +233,10 @@ namespace INMOST
template
<
typename
EType
>
void
Mesh
::
base_iterator
<
EType
>::
Print
()
{
printf
(
"Number: %10d CurrentType %x types %x
\n
"
,
lid
,
etype
,
types
);
std
::
cout
<<
"Number: "
<<
lid
<<
" CurrentType "
<<
ElementTypeName
(
etype
)
<<
" types "
;
for
(
ElementType
et
=
NODE
;
et
!=
LastElementType
();
et
=
NextElementType
(
et
)
)
if
(
et
&
types
)
std
::
cout
<<
ElementTypeName
(
et
)
<<
" "
;
std
::
cout
<<
std
::
endl
;
//printf("Number: %10d CurrentType %x types %x\n",lid,etype,types);
}
Storage
::
integer
Mesh
::
NextLocalIDIter
(
ElementType
etype
,
integer
lid
)
const
...
...
Source/Mesh/parallel.cpp
View file @
d4bc436b
...
...
@@ -869,7 +869,18 @@ namespace INMOST
return
output
;
}
Storage
::
enumerator
Mesh
::
Integrate
(
Storage
::
enumerator
input
)
{
ENTER_FUNC
();
Storage
::
enumerator
output
=
input
;
#if defined(USE_MPI)
REPORT_MPI
(
MPI_Allreduce
(
&
input
,
&
output
,
1
,
INMOST_MPI_DATA_ENUM_TYPE
,
MPI_SUM
,
comm
));
#else//USE_MPI
(
void
)
input
;
#endif//USE_MPI
EXIT_FUNC
();
return
output
;
}
Storage
::
integer
Mesh
::
Integrate
(
Storage
::
integer
input
)
...
...
@@ -915,6 +926,21 @@ namespace INMOST
EXIT_FUNC
();
}
void
Mesh
::
Integrate
(
Storage
::
enumerator
*
input
,
Storage
::
integer
size
)
{
ENTER_FUNC
();
#if defined(USE_MPI)
static
dynarray
<
Storage
::
enumerator
,
64
>
temp
;
temp
.
resize
(
size
);
memcpy
(
temp
.
data
(),
input
,
sizeof
(
Storage
::
enumerator
)
*
size
);
REPORT_MPI
(
MPI_Allreduce
(
temp
.
data
(),
input
,
size
,
INMOST_MPI_DATA_ENUM_TYPE
,
MPI_SUM
,
comm
));
#else//USE_MPI
(
void
)
input
;
(
void
)
size
;
#endif//USE_MPI
EXIT_FUNC
();
}
Storage
::
integer
Mesh
::
ExclusiveSum
(
Storage
::
integer
input
)
{
ENTER_FUNC
();
...
...
@@ -1754,7 +1780,7 @@ namespace INMOST
v
.
push_back
(
mpirank
);
}
else
owner
=
std
::
min
(
mpirank
,
v
[
0
]);
owner
=
std
::
min
<
Storage
::
integer
>
(
mpirank
,
v
[
0
]);
it
->
IntegerDF
(
tag_owner
)
=
owner
;
...
...
@@ -2075,7 +2101,7 @@ namespace INMOST
pr
.
push_back
(
mpirank
);
}
else
owner
=
std
::
min
(
mpirank
,
pr
[
0
]);
owner
=
std
::
min
<
Storage
::
integer
>
(
mpirank
,
pr
[
0
]);
it
->
IntegerDF
(
tag_owner
)
=
owner
;
if
(
mpirank
==
owner
)
{
...
...
@@ -2334,7 +2360,7 @@ namespace INMOST
//std::cout << GetProcessorRank() << " start " << ElementTypeName(mask) << std::endl;
//if( mask & CELL )
//{
int
cnt
=
0
;
INMOST_DATA_ENUM_TYPE
cnt
=
0
;
for
(
const
HandleType
*
it
=
ghost
;
it
!=
ghost
+
num
;
it
++
)
if
(
(
GetHandleElementType
(
*
it
)
&
mask
)
&&
GetStatus
(
*
it
)
==
Element
::
Ghost
)
{
...
...
Source/Solver/solver.cpp
View file @
d4bc436b
...
...
@@ -224,7 +224,7 @@ namespace INMOST {
INMOST
::
to_string
(
this
->
PreconditionerTime
()
+
this
->
IterationsTime
());
}
INMOST_DATA_REAL_TYPE
Solver
::
Condest
(
INMOST_DATA_REAL_TYPE
tol
,
unsigned
int
maxits
)
{
INMOST_DATA_REAL_TYPE
Solver
::
Condest
(
INMOST_DATA_REAL_TYPE
tol
,
INMOST_DATA_ENUM_TYPE
maxits
)
{
if
(
!
solver
->
isMatrixSet
())
throw
MatrixNotSetInSolver
;
return
solver
->
Condest
(
tol
,
maxits
);
}
...
...
Source/Solver/solver_inner/solver_ddpqiluc2/solver_ddpqiluc2.cpp
View file @
d4bc436b
...
...
@@ -2864,7 +2864,7 @@ swap_algorithm:
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
tt
=
Timer
();
if
((
1.0
*
nzA
/
std
::
max
(
1
u
,(
wend
-
wbeg
)
*
(
wend
-
wbeg
)))
>
0.75
&&
(
1.0
*
(
wend
-
wbeg
))
/
(
1.0
*
std
::
max
(
1
u
,
moend
-
mobeg
))
>
0.1
)
if
((
1.0
*
nzA
/
std
::
max
<
INMOST_DATA_ENUM_TYPE
>
(
1
,(
wend
-
wbeg
)
*
(
wend
-
wbeg
)))
>
0.75
&&
(
1.0
*
(
wend
-
wbeg
))
/
(
1.0
*
std
::
max
<
INMOST_DATA_ENUM_TYPE
>
(
1
,
moend
-
mobeg
))
>
0.1
)
{
std
::
cout
<<
"Try to sparsify schur complement!!!"
<<
std
::
endl
;
std
::
cout
<<
"Sparsity: "
<<
1.0
*
nzA
/
((
wend
-
wbeg
)
*
(
wend
-
wbeg
))
<<
std
::
endl
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment