Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
openfpm_numerics
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
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
Sbalzarini Lab
Software
Parallel Computing
OpenFPM
openfpm_numerics
Commits
f31559a7
Commit
f31559a7
authored
1 year ago
by
Abhinav Singh
Browse files
Options
Downloads
Patches
Plain Diff
update to tests
parent
b45058b1
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/OdeIntegrators/tests/OdeIntegratores_base_tests.cpp
+22
-14
22 additions, 14 deletions
src/OdeIntegrators/tests/OdeIntegratores_base_tests.cpp
src/OdeIntegrators/tests/Odeintegrators_test_gpu.cu
+4
-0
4 additions, 0 deletions
src/OdeIntegrators/tests/Odeintegrators_test_gpu.cu
with
26 additions
and
14 deletions
src/OdeIntegrators/tests/OdeIntegratores_base_tests.cpp
+
22
−
14
View file @
f31559a7
...
...
@@ -86,7 +86,11 @@ void Exponential_struct_ofp2( const state_type_3d_ofp &x , state_type_3d_ofp &dx
void
Exponential
(
const
state_type
&
x
,
state_type
&
dxdt
,
const
double
t
)
{
//timer tt;
//tt.start();
dxdt
=
x
;
//tt.stop();
//std::cout<<tt.getwct()<<std::endl;
}
void
sigmoid
(
const
state_type
&
x
,
state_type
&
dxdt
,
const
double
t
)
{
...
...
@@ -97,7 +101,7 @@ BOOST_AUTO_TEST_SUITE(odeInt_BASE_tests)
BOOST_AUTO_TEST_CASE
(
odeint_base_test1
)
{
size_t
edgeSemiSize
=
40
;
size_t
edgeSemiSize
=
512
;
const
size_t
sz
[
2
]
=
{
edgeSemiSize
,
edgeSemiSize
};
Box
<
2
,
double
>
box
({
0
,
0
},
{
1.0
,
1.0
});
size_t
bc
[
2
]
=
{
NON_PERIODIC
,
NON_PERIODIC
};
...
...
@@ -109,7 +113,9 @@ BOOST_AUTO_TEST_CASE(odeint_base_test1)
BOOST_TEST_MESSAGE
(
"Init vector_dist..."
);
vector_dist
<
2
,
double
,
aggregate
<
double
,
double
,
double
>>
Particles
(
0
,
box
,
bc
,
ghost
);
double
t0
=-
5
,
tf
=
5
,
t
;
t
=
t0
;
const
double
dt
=
0.01
;
auto
it
=
Particles
.
getGridIterator
(
sz
);
while
(
it
.
isNext
())
{
...
...
@@ -121,8 +127,8 @@ BOOST_AUTO_TEST_CASE(odeint_base_test1)
mem_id
k1
=
key
.
get
(
1
);
double
yp0
=
k1
*
spacing
[
1
];
Particles
.
getLastPos
()[
1
]
=
yp0
;
Particles
.
getLastProp
<
0
>
()
=
xp0
*
yp0
*
exp
(
0
);
Particles
.
getLastProp
<
1
>
()
=
xp0
*
yp0
*
exp
(
0.4
);
Particles
.
getLastProp
<
0
>
()
=
xp0
*
yp0
*
exp
(
t
0
);
Particles
.
getLastProp
<
1
>
()
=
xp0
*
yp0
*
exp
(
tf
);
++
it
;
}
...
...
@@ -136,14 +142,15 @@ BOOST_AUTO_TEST_CASE(odeint_base_test1)
x0
=
Init
;
// The rhs of x' = f(x)
double
t
=
0
,
tf
=
0.4
;
const
double
dt
=
0.1
;
//This doesnt work Why?
//size_t steps=boost::numeric::odeint::integrate(Exponential,x0,0.0,tf,dt);
size_t
steps
=
boost
::
numeric
::
odeint
::
integrate_const
(
boost
::
numeric
::
odeint
::
runge_kutta4
<
state_type
>
(),
Exponential
,
x0
,
0.0
,
tf
,
dt
);
//This doesnt work Why?
//size_t steps=boost::numeric::odeint::integrate(Exponential,x0,t,tf,dt);
timer
tt
;
tt
.
start
();
size_t
steps
=
boost
::
numeric
::
odeint
::
integrate_const
(
boost
::
numeric
::
odeint
::
runge_kutta4
<
state_type
>
(),
Exponential
,
x0
,
t
,
tf
,
dt
);
tt
.
stop
();
std
::
cout
<<
"Time taken by CPU:"
<<
tt
.
getwct
()
<<
std
::
endl
;
OdeSol
=
x0
;
auto
it2
=
Particles
.
getDomainIterator
();
double
worst
=
0.0
;
...
...
@@ -157,17 +164,18 @@ BOOST_AUTO_TEST_CASE(odeint_base_test1)
//std::cout<<worst<<std::endl;
BOOST_REQUIRE
(
worst
<
1e-6
);
t
=
t0
;
x0
=
Init
;
//Particles.write("first");
boost
::
numeric
::
odeint
::
runge_kutta4
<
state_type
>
rk4
;
while
(
t
<
tf
)
for
(
int
i
=
0
;
i
<
floor
((
tf
-
t0
)
/
dt
+
0.5
);
i
++
)
{
rk4
.
do_step
(
Exponential
,
x0
,
t
,
dt
);
OdeSol
=
x0
;
t
+=
dt
;
}
//std::cout<<"Final TIme:"<<t<<std::endl;
OdeSol
=
x0
;
//Particles.write("second");
auto
it3
=
Particles
.
getDomainIterator
();
double
worst2
=
0.0
;
while
(
it3
.
isNext
())
{
...
...
This diff is collapsed.
Click to expand it.
src/OdeIntegrators/tests/Odeintegrators_test_gpu.cu
+
4
−
0
View file @
f31559a7
...
...
@@ -24,7 +24,11 @@ typedef state_type_1d_ofp_gpu state_type;
void
ExponentialGPU
(
const
state_type
&
x
,
state_type
&
dxdt
,
const
double
t
)
{
//timer tt;
//tt.startGPU();
dxdt
.
data
.
get
<
0
>
()
=
x
.
data
.
get
<
0
>
();
//tt.stopGPU();
//std::cout<<"GPU Time:"<<tt.getwctGPU()<<std::endl;
//x.data.get<0>().getVector().deviceToHost<0>();
//dxdt.data.get<0>().getVector().deviceToHost<0>();
}
...
...
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