Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
N
NP_TMcode
Manage
Activity
Members
Plan
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container registry
Analyze
Contributor analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Giacomo Mulas
NP_TMcode
Commits
d0ff91f2
Commit
d0ff91f2
authored
2 months ago
by
Giovanni La Mura
Browse files
Options
Downloads
Patches
Plain Diff
Use logger in TRAPPING suite
parent
1e182f64
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/trapping/cfrfme.cpp
+30
-9
30 additions, 9 deletions
src/trapping/cfrfme.cpp
src/trapping/clffft.cpp
+9
-1
9 additions, 1 deletion
src/trapping/clffft.cpp
with
39 additions
and
10 deletions
src/trapping/cfrfme.cpp
+
30
−
9
View file @
d0ff91f2
...
@@ -18,6 +18,7 @@
...
@@ -18,6 +18,7 @@
*
*
* C++ implementation of FRFME functions.
* C++ implementation of FRFME functions.
*/
*/
#include
<chrono>
#include
<cstdio>
#include
<cstdio>
#include
<exception>
#include
<exception>
#include
<fstream>
#include
<fstream>
...
@@ -71,6 +72,11 @@ void frfme(string data_file, string output_path) {
...
@@ -71,6 +72,11 @@ void frfme(string data_file, string output_path) {
#ifdef USE_NVTX
#ifdef USE_NVTX
nvtxRangePush
(
"Running frfme()"
);
nvtxRangePush
(
"Running frfme()"
);
#endif
#endif
chrono
::
time_point
<
chrono
::
high_resolution_clock
>
t_start
=
chrono
::
high_resolution_clock
::
now
();
chrono
::
duration
<
double
>
elapsed
;
char
buffer
[
256
];
string
message
=
"INIT"
;
Logger
logger
(
LOG_INFO
);
string
tfrfme_name
=
output_path
+
"/c_TFRFME.hd5"
;
string
tfrfme_name
=
output_path
+
"/c_TFRFME.hd5"
;
TFRFME
*
tfrfme
=
NULL
;
TFRFME
*
tfrfme
=
NULL
;
Swap1
*
tt1
=
NULL
;
Swap1
*
tt1
=
NULL
;
...
@@ -143,10 +149,12 @@ void frfme(string data_file, string output_path) {
...
@@ -143,10 +149,12 @@ void frfme(string data_file, string output_path) {
nlmmt
=
tt2
->
nlmmt
;
nlmmt
=
tt2
->
nlmmt
;
nrvc
=
tt2
->
nrvc
;
nrvc
=
tt2
->
nrvc
;
}
else
{
}
else
{
printf
(
"ERROR: could not open TEMPTAPE2 file.
\n
"
);
message
=
"ERROR: could not open TEMPTAPE2 file.
\n
"
;
logger
.
err
(
message
);
}
}
}
else
{
}
else
{
printf
(
"ERROR: could not open TFRFME file.
\n
"
);
message
=
"ERROR: could not open TFRFME file.
\n
"
;
logger
.
err
(
message
);
}
}
nks
=
nkv
-
1
;
nks
=
nkv
-
1
;
#ifdef USE_NVTX
#ifdef USE_NVTX
...
@@ -272,13 +280,16 @@ void frfme(string data_file, string output_path) {
...
@@ -272,13 +280,16 @@ void frfme(string data_file, string output_path) {
// Array initialization
// Array initialization
long
swap1_size
,
swap2_size
,
tfrfme_size
;
long
swap1_size
,
swap2_size
,
tfrfme_size
;
double
size_mb
;
double
size_mb
;
printf
(
"INFO: calculating memory requirements
\n
"
);
message
=
"INFO: calculating memory requirements...
\n
"
;
logger
.
log
(
message
);
swap1_size
=
Swap1
::
get_size
(
lm
,
nkv
);
swap1_size
=
Swap1
::
get_size
(
lm
,
nkv
);
size_mb
=
1.0
*
swap1_size
/
1024.0
/
1024.0
;
size_mb
=
1.0
*
swap1_size
/
1024.0
/
1024.0
;
printf
(
"Swap 1: %.2lg MB
\n
"
,
size_mb
);
printf
(
"Swap 1: %.2lg MB
\n
"
,
size_mb
);
swap2_size
=
Swap2
::
get_size
(
nkv
);
swap2_size
=
Swap2
::
get_size
(
nkv
);
size_mb
=
1.0
*
swap2_size
/
1024.0
/
1024.0
;
size_mb
=
1.0
*
swap2_size
/
1024.0
/
1024.0
;
printf
(
"Swap 2: %.2lg MB
\n
"
,
size_mb
);
sprintf
(
buffer
,
"Swap 2: %.2lg MB
\n
"
,
size_mb
);
message
=
string
(
buffer
);
logger
.
log
(
message
);
tt2
=
new
Swap2
(
nkv
);
tt2
=
new
Swap2
(
nkv
);
vkv
=
tt2
->
get_vector
();
vkv
=
tt2
->
get_vector
();
vkzm
=
tt2
->
get_matrix
();
vkzm
=
tt2
->
get_matrix
();
...
@@ -301,9 +312,13 @@ void frfme(string data_file, string output_path) {
...
@@ -301,9 +312,13 @@ void frfme(string data_file, string output_path) {
int
nzshpo
=
nzsh
+
1
;
int
nzshpo
=
nzsh
+
1
;
tfrfme_size
=
TFRFME
::
get_size
(
lm
,
nkv
,
nxv
,
nyv
,
nzv
);
tfrfme_size
=
TFRFME
::
get_size
(
lm
,
nkv
,
nxv
,
nyv
,
nzv
);
size_mb
=
1.0
*
tfrfme_size
/
1024.0
/
1024.0
;
size_mb
=
1.0
*
tfrfme_size
/
1024.0
/
1024.0
;
printf
(
"TFRFME: %.2lg MB
\n
"
,
size_mb
);
sprintf
(
buffer
,
"TFRFME: %.2lg MB
\n
"
,
size_mb
);
message
=
string
(
buffer
);
logger
.
log
(
message
);
size_mb
=
1.0
*
(
swap1_size
+
swap2_size
+
tfrfme_size
)
/
1024.0
/
1024.0
;
size_mb
=
1.0
*
(
swap1_size
+
swap2_size
+
tfrfme_size
)
/
1024.0
/
1024.0
;
printf
(
"TOTAL: %.2lg MB
\n
"
,
size_mb
);
sprintf
(
buffer
,
"TOTAL: %.2lg MB
\n
"
,
size_mb
);
message
=
string
(
buffer
);
logger
.
log
(
message
);
tfrfme
=
new
TFRFME
(
lmode
,
lm
,
nkv
,
nxv
,
nyv
,
nzv
);
tfrfme
=
new
TFRFME
(
lmode
,
lm
,
nkv
,
nxv
,
nyv
,
nzv
);
double
*
_xv
=
tfrfme
->
get_x
();
double
*
_xv
=
tfrfme
->
get_x
();
double
*
_yv
=
tfrfme
->
get_y
();
double
*
_yv
=
tfrfme
->
get_y
();
...
@@ -383,10 +398,12 @@ void frfme(string data_file, string output_path) {
...
@@ -383,10 +398,12 @@ void frfme(string data_file, string output_path) {
dcomplex
*
wk_local
=
new
dcomplex
[
nlmmt
]();
dcomplex
*
wk_local
=
new
dcomplex
[
nlmmt
]();
for
(
int
wi
=
0
;
wi
<
nkv
;
wi
++
)
w
[
wi
]
=
vec_w
+
wi
*
nkv
;
for
(
int
wi
=
0
;
wi
<
nkv
;
wi
++
)
w
[
wi
]
=
vec_w
+
wi
*
nkv
;
int
wk_index
=
0
;
int
wk_index
=
0
;
int
nkvs
=
nkv
*
nkv
;
for
(
int
jy50
=
0
;
jy50
<
nkv
;
jy50
++
)
{
for
(
int
jy50
=
0
;
jy50
<
nkv
;
jy50
++
)
{
for
(
int
jx50
=
0
;
jx50
<
nkv
;
jx50
++
)
{
for
(
int
jx50
=
0
;
jx50
<
nkv
;
jx50
++
)
{
for
(
int
wi
=
0
;
wi
<
nlmmt
;
wi
++
)
wk_local
[
wi
]
=
tt1
->
wk
[
wk_index
++
];
for
(
int
wi
=
0
;
wi
<
nlmmt
;
wi
++
)
wk_local
[
wi
]
=
tt1
->
wk
[
wk_index
++
];
w
[
jx50
][
jy50
]
=
wk_local
[
j80
-
1
];
w
[
jx50
][
jy50
]
=
wk_local
[
j80
-
1
];
// w[jx50][jy50] = tt1->wk[jy50 * nkvs + jx50 * nkv + j80 - 1];
}
// jx50
}
// jx50
}
// jy50 loop
}
// jy50 loop
int
ixyz
=
0
;
int
ixyz
=
0
;
...
@@ -443,10 +460,12 @@ void frfme(string data_file, string output_path) {
...
@@ -443,10 +460,12 @@ void frfme(string data_file, string output_path) {
nvtxRangePop
();
nvtxRangePop
();
#endif
#endif
}
else
{
// Should never happen.
}
else
{
// Should never happen.
printf
(
"ERROR: could not open TFRFME file for output.
\n
"
);
message
=
"ERROR: could not open TFRFME file for output.
\n
"
;
logger
.
err
(
message
);
}
}
}
else
{
}
else
{
printf
(
"ERROR: could not open TEDF file.
\n
"
);
message
=
"ERROR: could not open TEDF file.
\n
"
;
logger
.
err
(
message
);
}
}
}
else
{
// label 98
}
else
{
// label 98
string
output_name
=
output_path
+
"/c_OFRFME"
;
string
output_name
=
output_path
+
"/c_OFRFME"
;
...
@@ -470,7 +489,9 @@ void frfme(string data_file, string output_path) {
...
@@ -470,7 +489,9 @@ void frfme(string data_file, string output_path) {
#ifdef USE_NVTX
#ifdef USE_NVTX
nvtxRangePop
();
nvtxRangePop
();
#endif
#endif
printf
(
"FRFME: Done.
\n
"
);
elapsed
=
chrono
::
high_resolution_clock
::
now
()
-
t_start
;
message
=
"INFO: FRFME took "
+
to_string
(
elapsed
.
count
())
+
"s.
\n
"
;
logger
.
log
(
message
);
#ifdef USE_NVTX
#ifdef USE_NVTX
nvtxRangePop
();
nvtxRangePop
();
#endif
#endif
...
...
This diff is collapsed.
Click to expand it.
src/trapping/clffft.cpp
+
9
−
1
View file @
d0ff91f2
...
@@ -18,6 +18,7 @@
...
@@ -18,6 +18,7 @@
*
*
* \brief C++ implementation of LFFFT functions.
* \brief C++ implementation of LFFFT functions.
*/
*/
#include
<chrono>
#include
<cstdio>
#include
<cstdio>
#include
<exception>
#include
<exception>
#include
<fstream>
#include
<fstream>
...
@@ -71,10 +72,15 @@ void lffft(string data_file, string output_path) {
...
@@ -71,10 +72,15 @@ void lffft(string data_file, string output_path) {
#ifdef USE_NVTX
#ifdef USE_NVTX
nvtxRangePush
(
"Running lffft()"
);
nvtxRangePush
(
"Running lffft()"
);
#endif
#endif
chrono
::
time_point
<
chrono
::
high_resolution_clock
>
t_start
=
chrono
::
high_resolution_clock
::
now
();
chrono
::
duration
<
double
>
elapsed
;
const
dcomplex
uim
=
0.0
+
1.0
*
I
;
const
dcomplex
uim
=
0.0
+
1.0
*
I
;
const
double
sq2i
=
1.0
/
sqrt
(
2.0
);
const
double
sq2i
=
1.0
/
sqrt
(
2.0
);
const
dcomplex
sq2iti
=
sq2i
*
uim
;
const
dcomplex
sq2iti
=
sq2i
*
uim
;
char
buffer
[
256
];
string
message
=
"INIT"
;
Logger
logger
(
LOG_INFO
);
fstream
tlfff
,
tlfft
;
fstream
tlfff
,
tlfft
;
double
****
zpv
=
NULL
;
double
****
zpv
=
NULL
;
dcomplex
*
ac
=
NULL
,
*
ws
=
NULL
,
*
wsl
=
NULL
;
dcomplex
*
ac
=
NULL
,
*
ws
=
NULL
,
*
wsl
=
NULL
;
...
@@ -480,7 +486,9 @@ void lffft(string data_file, string output_path) {
...
@@ -480,7 +486,9 @@ void lffft(string data_file, string output_path) {
delete
cil
;
delete
cil
;
delete
ccr
;
delete
ccr
;
delete
[]
file_lines
;
delete
[]
file_lines
;
printf
(
"LFFT: Done.
\n
"
);
elapsed
=
chrono
::
high_resolution_clock
::
now
()
-
t_start
;
message
=
"INFO: LFFT took "
+
to_string
(
elapsed
.
count
())
+
"s.
\n
"
;
logger
.
log
(
message
);
#ifdef USE_NVTX
#ifdef USE_NVTX
nvtxRangePop
();
nvtxRangePop
();
#endif
#endif
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment