Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
tug
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
naaice
tug
Commits
28b16d61
Commit
28b16d61
authored
1 year ago
by
hmars-t
Browse files
Options
Downloads
Patches
Plain Diff
add profiling example for pass by reference method
parent
fbdeba00
No related branches found
No related tags found
No related merge requests found
Pipeline
#63407
failed
1 year ago
Stage: build
Stage: test
Stage: static_analyze
Changes
2
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
examples/CMakeLists.txt
+3
-0
3 additions, 0 deletions
examples/CMakeLists.txt
examples/profiling_reference.cpp
+51
-0
51 additions, 0 deletions
examples/profiling_reference.cpp
with
54 additions
and
0 deletions
examples/CMakeLists.txt
+
3
−
0
View file @
28b16d61
...
...
@@ -5,6 +5,7 @@ add_executable(FTCS_2D_proto_example FTCS_2D_proto_example.cpp)
add_executable
(
FTCS_2D_proto_example_mdl FTCS_2D_proto_example_mdl.cpp
)
add_executable
(
FTCS_1D_proto_example FTCS_1D_proto_example.cpp
)
add_executable
(
reference-FTCS_2D_closed reference-FTCS_2D_closed.cpp
)
add_executable
(
profiling_reference profiling_reference.cpp
)
target_link_libraries
(
first_example tug
)
target_link_libraries
(
second_example tug
)
target_link_libraries
(
boundary_example1D tug
)
...
...
@@ -12,4 +13,6 @@ target_link_libraries(FTCS_2D_proto_example tug)
target_link_libraries
(
FTCS_2D_proto_example_mdl tug
)
target_link_libraries
(
FTCS_1D_proto_example tug
)
target_link_libraries
(
reference-FTCS_2D_closed tug
)
target_link_libraries
(
profiling_reference tug
)
# target_link_libraries(FTCS_2D_proto_example easy_profiler)
This diff is collapsed.
Click to expand it.
examples/profiling_reference.cpp
0 → 100644
+
51
−
0
View file @
28b16d61
#include
<tug/Simulation.hpp>
#include
<iostream>
#include
<fstream>
int
main
(
int
argc
,
char
*
argv
[])
{
int
n
[
4
]
=
{
10
,
20
,
50
,
100
};
int
iterations
[
1
]
=
{
100
};
int
repetition
=
10
;
ofstream
myfile
;
myfile
.
open
(
"time_measure_experiment_reference.csv"
);
for
(
int
i
=
0
;
i
<
size
(
n
);
i
++
){
cout
<<
"Grid size: "
<<
n
[
i
]
<<
" x "
<<
n
[
i
]
<<
endl
<<
endl
;
myfile
<<
"Grid size: "
<<
n
[
i
]
<<
" x "
<<
n
[
i
]
<<
endl
<<
endl
;
for
(
int
j
=
0
;
j
<
size
(
iterations
);
j
++
){
cout
<<
"Iterations: "
<<
iterations
[
j
]
<<
endl
;
myfile
<<
"Iterations: "
<<
iterations
[
j
]
<<
endl
;
for
(
int
k
=
0
;
k
<
repetition
;
k
++
){
cout
<<
"Wiederholung: "
<<
k
<<
endl
;
Grid
grid
=
Grid
(
n
[
i
],
n
[
i
]);
grid
.
setDomain
(
n
[
i
],
n
[
i
]);
MatrixXd
concentrations
=
MatrixXd
::
Constant
(
n
[
i
],
n
[
i
],
0
);
concentrations
(
5
,
5
)
=
1
;
grid
.
setConcentrations
(
concentrations
);
MatrixXd
alpha
=
MatrixXd
::
Constant
(
n
[
i
],
n
[
i
],
0.5
);
Boundary
bc
=
Boundary
(
grid
);
Simulation
sim
=
Simulation
(
grid
,
bc
,
FTCS_APPROACH
);
sim
.
setTimestep
(
0.001
);
sim
.
setIterations
(
iterations
[
j
]);
sim
.
setOutputCSV
(
CSV_OUTPUT_OFF
);
auto
begin
=
std
::
chrono
::
high_resolution_clock
::
now
();
sim
.
run
();
auto
end
=
std
::
chrono
::
high_resolution_clock
::
now
();
auto
milliseconds
=
std
::
chrono
::
duration_cast
<
std
::
chrono
::
milliseconds
>
(
end
-
begin
);
myfile
<<
milliseconds
.
count
()
<<
endl
;
}
}
cout
<<
endl
;
myfile
<<
endl
;
}
myfile
.
close
();
}
\ No newline at end of file
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