Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
Cubism
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
mavt-cse
Cubism
Commits
063c0ec8
Commit
063c0ec8
authored
Apr 27, 2019
by
fabianw
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix compiler warnings
parent
f9e21938
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
41 additions
and
31 deletions
+41
-31
include/Cubism/GridMorton.h
include/Cubism/GridMorton.h
+1
-2
include/Cubism/HDF5SubdomainDumper.h
include/Cubism/HDF5SubdomainDumper.h
+1
-0
include/Cubism/Histogram.h
include/Cubism/Histogram.h
+0
-1
include/Cubism/Indexers.h
include/Cubism/Indexers.h
+16
-16
include/Cubism/LosslessCompression.h
include/Cubism/LosslessCompression.h
+3
-1
include/Cubism/PlainBinDumper_MPI.h
include/Cubism/PlainBinDumper_MPI.h
+4
-1
include/Cubism/ZBinDumper.h
include/Cubism/ZBinDumper.h
+10
-8
include/Cubism/ZBinDumper_MPI.h
include/Cubism/ZBinDumper_MPI.h
+5
-1
src/Histogram.cpp
src/Histogram.cpp
+1
-1
No files found.
include/Cubism/GridMorton.h
View file @
063c0ec8
...
...
@@ -106,7 +106,6 @@ protected:
TBlock
&
operator
()(
int
ix
,
int
iy
=
0
,
int
iz
=
0
)
const
{
const
int
N
=
this
->
N
;
const
int
NX
=
this
->
NX
;
const
int
NY
=
this
->
NY
;
const
int
NZ
=
this
->
NZ
;
...
...
@@ -129,7 +128,7 @@ protected:
assert
(
iflat
>=
0
&&
iflat
<
f2m
.
size
());
const
unsigned
int
idx
=
f2m
[
iflat
];
assert
(
idx
>=
0
&&
idx
<
N
);
assert
(
idx
>=
0
&&
idx
<
this
->
N
);
return
*
(
this
->
_linaccess
(
idx
));
}
...
...
include/Cubism/HDF5SubdomainDumper.h
View file @
063c0ec8
...
...
@@ -232,6 +232,7 @@ namespace SubdomainTypes
}
Subdomain
(
const
Subdomain
&
c
)
=
default
;
virtual
~
Subdomain
()
=
default
;
inline
int
id
()
const
{
return
m_id
;
}
inline
const
int
(
&
bbox_start
()
const
)[
3
]
{
return
m_bbox_start
;
}
...
...
include/Cubism/Histogram.h
View file @
063c0ec8
...
...
@@ -23,7 +23,6 @@ class Histogram
std
::
map
<
std
::
string
,
std
::
vector
<
float
>
>
mk2t
;
bool
isroot
;
bool
bInitialized
;
int
reportID
;
void
_print2file
(
std
::
string
sKernel
,
std
::
vector
<
float
>
&
buf
);
void
_print_statistcis
(
std
::
string
sKernel
,
std
::
vector
<
float
>
&
buf
);
...
...
include/Cubism/Indexers.h
View file @
063c0ec8
...
...
@@ -19,22 +19,22 @@ class Indexer
{
protected:
const
unsigned
int
sizeX
,
sizeY
,
sizeZ
,
sizeTotal
;
public:
Indexer
(
const
unsigned
int
sizeX
,
const
unsigned
int
sizeY
,
const
unsigned
int
sizeZ
)
:
sizeX
(
sizeX
),
sizeY
(
sizeY
),
sizeZ
(
sizeZ
),
sizeTotal
(
sizeX
*
sizeY
*
sizeZ
)
public:
Indexer
(
const
unsigned
int
sizeX
_
,
const
unsigned
int
sizeY_
,
const
unsigned
int
sizeZ_
)
:
sizeX
(
sizeX
_
),
sizeY
(
sizeY_
),
sizeZ
(
sizeZ_
),
sizeTotal
(
sizeX_
*
sizeY_
*
sizeZ_
)
{
}
virtual
unsigned
int
encode
(
unsigned
int
ix
,
unsigned
int
iy
,
unsigned
int
iz
)
const
{
const
unsigned
int
retval
=
ix
+
sizeX
*
(
iy
+
iz
*
sizeY
);
assert
(
retval
<
sizeTotal
&&
retval
>=
0
);
return
retval
;
return
retval
;
}
virtual
void
decode
(
unsigned
int
code
,
unsigned
int
&
ix
,
unsigned
int
&
iy
,
unsigned
int
&
iz
)
const
{
ix
=
code
%
sizeX
;
...
...
@@ -47,33 +47,33 @@ class IndexerMorton : public Indexer
{
unsigned
int
depth
;
public:
IndexerMorton
(
const
unsigned
int
sizeX
,
const
unsigned
int
sizeY
,
const
unsigned
int
sizeZ
)
:
Indexer
(
sizeX
,
sizeY
,
sizeZ
)
IndexerMorton
(
const
unsigned
int
sizeX
_
,
const
unsigned
int
sizeY_
,
const
unsigned
int
sizeZ_
)
:
Indexer
(
sizeX
_
,
sizeY_
,
sizeZ_
)
{
depth
=
(
unsigned
int
)
fmin
(
10.
,
ceil
(
log2
((
double
)
fmax
(
sizeX
,
fmax
(
sizeY
,
sizeZ
)))));
}
unsigned
int
encode
(
unsigned
int
ix
,
unsigned
int
iy
,
unsigned
int
iz
)
const
{
unsigned
int
idx
=
0
;
for
(
unsigned
int
counter
=
0
;
counter
<
depth
;
++
counter
)
{
const
unsigned
int
bitmask
=
1
<<
counter
;
const
unsigned
int
idx0
=
ix
&
bitmask
;
const
unsigned
int
idx1
=
iy
&
bitmask
;
const
unsigned
int
idx2
=
iz
&
bitmask
;
idx
|=
((
idx0
<<
2
*
counter
)
|
(
idx1
<<
(
2
*
counter
+
1
))
|
(
idx2
<<
(
2
*
counter
+
2
)));
}
return
idx
;
return
idx
;
}
void
decode
(
unsigned
int
code
,
unsigned
int
&
ix
,
unsigned
int
&
iy
,
unsigned
int
&
iz
)
const
{
ix
=
iy
=
iz
=
0
;
for
(
unsigned
int
counter
=
0
;
counter
<
depth
;
++
counter
)
{
const
unsigned
int
bitmask_x
=
1
<<
(
counter
*
3
+
0
);
...
...
include/Cubism/LosslessCompression.h
View file @
063c0ec8
...
...
@@ -14,6 +14,8 @@
#include "Common.h"
#define DBG 0
CUBISM_NAMESPACE_BEGIN
extern
"C"
...
...
@@ -48,7 +50,7 @@ inline size_t
ZZcompress
(
unsigned
char
*
buf
,
size_t
len
,
int
layout
[
4
],
size_t
*
max
)
{
#if 1
in
t
zbufsize
=
0
;
size_
t
zbufsize
=
0
;
char
*
zbuf
=
NULL
;
zbufsize
=
len
+
4096
;
zbuf
=
(
char
*
)
malloc
(
zbufsize
);
...
...
include/Cubism/PlainBinDumper_MPI.h
View file @
063c0ec8
...
...
@@ -13,6 +13,7 @@
#include <iostream>
#include <string>
#include <sstream>
#include <cstdlib>
#include <mpi.h>
#include "Common.h"
...
...
@@ -110,7 +111,8 @@ void PlainReadBin_MPI(MPI_Comm comm, TReal **buffer, long *bytes, const std::str
#if DBG
printf
(
"Reading %ld bytes of binary data
\n
"
,
lbytes
);
#endif
unsigned
char
*
tmp
=
(
unsigned
char
*
)
malloc
(
lbytes
);
unsigned
long
*
tmp
=
nullptr
;
posix_memalign
((
void
**
)
&
tmp
,
16
,
lbytes
);
long
base
=
MAX_MPI_PROCS
*
sizeof
(
tag
);
// Header
MPI_File_read_at
(
file_id
,
base
+
offset
,
(
char
*
)
tmp
,
lbytes
,
MPI_CHAR
,
&
status
);
...
...
@@ -119,6 +121,7 @@ void PlainReadBin_MPI(MPI_Comm comm, TReal **buffer, long *bytes, const std::str
*
bytes
=
lbytes
;
MPI_File_close
(
&
file_id
);
free
(
tmp
);
}
CUBISM_NAMESPACE_END
include/Cubism/ZBinDumper.h
View file @
063c0ec8
...
...
@@ -17,6 +17,8 @@
#include "BlockInfo.h"
#include "LosslessCompression.h"
#define DBG 0
CUBISM_NAMESPACE_BEGIN
typedef
struct
_header_serial
{
...
...
@@ -43,7 +45,6 @@ void DumpZBin(const TGrid &grid,
filename
<<
dump_path
<<
"/"
<<
f_name
;
FILE
*
file_id
;
int
status
;
static
const
int
NCHANNELS
=
TStreamer
::
NCHANNELS
;
const
int
NX
=
grid
.
getBlocksPerDimension
(
0
)
*
B
::
sizeX
;
...
...
@@ -119,13 +120,13 @@ void DumpZBin(const TGrid &grid,
compressed_bytes
);
tag
.
size
[
ichannel
]
=
compressed_bytes
;
size_t
wb_data
=
fwrite
(
array_all
,
1
,
compressed_bytes
,
file_id
);
fwrite
(
array_all
,
1
,
compressed_bytes
,
file_id
);
}
fseek
(
file_id
,
0
,
SEEK_SET
);
size_t
wb_header
=
fwrite
(
&
tag
.
size
[
0
],
1
,
sizeof
(
tag
),
file_id
);
fwrite
(
&
tag
.
size
[
0
],
1
,
sizeof
(
tag
),
file_id
);
status
=
fclose
(
file_id
);
fclose
(
file_id
);
delete
[]
array_all
;
}
...
...
@@ -142,7 +143,6 @@ void ReadZBin(TGrid &grid,
std
::
ostringstream
filename
;
filename
<<
read_path
<<
"/"
<<
f_name
;
int
status
;
FILE
*
file_id
;
const
int
NX
=
grid
.
getBlocksPerDimension
(
0
)
*
B
::
sizeX
;
...
...
@@ -168,7 +168,7 @@ void ReadZBin(TGrid &grid,
size_t
local_bytes
=
local_count
*
sizeof
(
Real
);
header_serial
tag
;
size_t
rb_header
=
fread
(
&
tag
.
size
[
0
],
1
,
sizeof
(
tag
),
file_id
);
fread
(
&
tag
.
size
[
0
],
1
,
sizeof
(
tag
),
file_id
);
#if DBG
printf
(
"HEADER(%d):
\n
"
,
rank
);
...
...
@@ -191,10 +191,12 @@ void ReadZBin(TGrid &grid,
#endif
unsigned
char
*
tmp
=
(
unsigned
char
*
)
malloc
(
compressed_bytes
+
4096
);
size_t
rb_data
=
fread
(
tmp
,
1
,
compressed_bytes
,
file_id
);
fread
(
tmp
,
1
,
compressed_bytes
,
file_id
);
int
layout
[
4
]
=
{
NX
,
NY
,
NZ
,
1
};
#if DBG
size_t
decompressed_bytes
=
#endif
ZZdecompress
<
typename
TGrid
::
Real
>
(
tmp
,
compressed_bytes
,
layout
,
...
...
@@ -227,7 +229,7 @@ void ReadZBin(TGrid &grid,
}
}
/* ichannel */
status
=
fclose
(
file_id
);
fclose
(
file_id
);
delete
[]
array_all
;
}
...
...
include/Cubism/ZBinDumper_MPI.h
View file @
063c0ec8
...
...
@@ -19,6 +19,8 @@
#include "BlockInfo.h"
#include "LosslessCompression.h"
#define DBG 0
CUBISM_NAMESPACE_BEGIN
#define MAX_MPI_PROCS (16 * 1024) // header: 0.25MB* 8
...
...
@@ -246,13 +248,13 @@ void ReadZBin_MPI(TGrid &grid,
// size_t local_count = NX * NY * NZ * NCHANNELS;
size_t
local_count
=
NX
*
NY
*
NZ
*
1
;
size_t
local_bytes
=
local_count
*
sizeof
(
Real
);
long
offset
;
header
tag
;
MPI_File_read_at
(
file_id
,
rank
*
sizeof
(
tag
),
&
tag
,
2
*
8
,
MPI_LONG
,
&
status
);
#if DBG
long
offset
;
printf
(
"HEADER(%d):
\n
"
,
rank
);
for
(
int
i
=
0
;
i
<
NCHANNELS
;
i
++
)
{
printf
(
"channel %d: %ld %ld
\n
"
,
i
,
tag
.
offset
[
i
],
tag
.
size
[
i
]);
...
...
@@ -289,7 +291,9 @@ void ReadZBin_MPI(TGrid &grid,
// int layout[4] = {NCHANNELS, NX, NY, NZ};
int
layout
[
4
]
=
{
NX
,
NY
,
NZ
,
1
};
#if DBG
size_t
decompressed_bytes
=
#endif
ZZdecompress
<
typename
TGrid
::
Real
>
(
tmp
,
compressed_bytes
,
layout
,
...
...
src/Histogram.cpp
View file @
063c0ec8
...
...
@@ -67,7 +67,7 @@ void Histogram::_print2file(string sKernel, vector<float> & buf)
sprintf
(
f_name_ascii
,
"hist_%s"
,
sKernel
.
c_str
());
FILE
*
pFile_ascii
=
fopen
(
f_name_ascii
,
"a"
);
for
(
in
t
i
=
0
;
i
<
buf
.
size
();
++
i
)
for
(
size_
t
i
=
0
;
i
<
buf
.
size
();
++
i
)
fprintf
(
pFile_ascii
,
"%e
\n
"
,
buf
[
i
]);
fclose
(
pFile_ascii
);
}
...
...
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