Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
dune-istl
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
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
Core Modules
dune-istl
Commits
b560f4be
Commit
b560f4be
authored
18 years ago
by
Markus Blatt
Browse files
Options
Downloads
Patches
Plain Diff
Should not be here
[[Imported from SVN: r652]]
parent
11c0b9ff
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
istl/paamg/test/parallelamgtest.cc
+57
-28
57 additions, 28 deletions
istl/paamg/test/parallelamgtest.cc
with
57 additions
and
28 deletions
istl/paamg/test/parallelamgtest.cc
+
57
−
28
View file @
b560f4be
...
...
@@ -65,24 +65,11 @@ void MPI_err_handler(MPI_Comm *comm, int *err_code, ...){
throw
MPIError
(
s
,
*
err_code
);
}
int
main
(
int
argc
,
char
**
argv
)
template
<
int
BS
>
void
testAmg
(
int
N
,
int
coarsenTarget
)
{
MPI_Init
(
&
argc
,
&
argv
);
MPI_Errhandler
handler
;
MPI_Errhandler_create
(
MPI_err_handler
,
&
handler
);
MPI_Errhandler_set
(
MPI_COMM_WORLD
,
handler
);
const
int
BS
=
1
;
int
N
=
250
;
int
coarsenTarget
=
1200
;
if
(
argc
>
1
)
N
=
atoi
(
argv
[
1
]);
if
(
argc
>
2
)
coarsenTarget
=
atoi
(
argv
[
2
]);
std
::
cout
<<
"N="
<<
N
<<
" coarsenTarget="
<<
coarsenTarget
<<
std
::
endl
;
std
::
cout
<<
"==================================================="
<<
std
::
endl
;
std
::
cout
<<
"BS="
<<
BS
<<
" N="
<<
N
<<
" coarsenTarget="
<<
coarsenTarget
<<
std
::
endl
;
int
procs
,
rank
;
MPI_Comm_rank
(
MPI_COMM_WORLD
,
&
rank
);
...
...
@@ -137,7 +124,7 @@ int main(int argc, char** argv)
typedef
Dune
::
SeqJac
<
BCRSMat
,
Vector
,
Vector
>
Smoother
;
typedef
Dune
::
BlockPreconditioner
<
Vector
,
Vector
,
Communication
,
Smoother
>
ParSmoother
;
//typedef Dune::ParSSOR<BCRSMat,Vector,Vector,Communication> ParSmoother;
typedef
Dune
::
Amg
::
SmootherTraits
<
ParSmoother
>::
Arguments
SmootherArgs
;
typedef
typename
Dune
::
Amg
::
SmootherTraits
<
ParSmoother
>::
Arguments
SmootherArgs
;
//typedef Dune::Amg::BlockPreconditionerConstructionArgs<Smoother,Communication> SmootherArgs;
Dune
::
OverlappingSchwarzScalarProduct
<
Vector
,
Communication
>
sp
(
comm
);
...
...
@@ -167,7 +154,7 @@ int main(int argc, char** argv)
Dune
::
CGSolver
<
Vector
>
amgCG
(
fop
,
sp
,
amg
,
10e-8
,
300
,
(
rank
==
0
)
?
2
:
0
);
watch
.
reset
();
//
amgCG.apply(x,b,r);
amgCG
.
apply
(
x
,
b
,
r
);
MPI_Barrier
(
MPI_COMM_WORLD
);
double
solvetime
=
watch
.
elapsed
();
...
...
@@ -181,21 +168,63 @@ int main(int argc, char** argv)
std
::
cout
<<
"AMG building took "
<<
(
buildtime
/
r
.
elapsed
*
r
.
iterations
)
<<
" iterations"
<<
std
::
endl
;
std
::
cout
<<
"AMG building together with slving took "
<<
buildtime
+
solvetime
<<
std
::
endl
;
}
/*
Smoother ssm(fop.getmat(),1,1);
ParSmoother sm(ssm,comm);
//DoubleStepPreconditioner<ParSmoother> dsp(sm);
Dune::LoopSolver<Vector> cg(fop, sp, sm, 10e-08, 30, (rank==0)?2:0);
Smoother
ssm
(
fop
.
getmat
(),
1
,
1
);
ParSmoother
sm
(
ssm
,
comm
);
//DoubleStepPreconditioner<ParSmoother> dsp(sm);
Dune
::
LoopSolver
<
Vector
>
cg
(
fop
,
sp
,
sm
,
10e-08
,
30
,
(
rank
==
0
)
?
2
:
0
);
watch.reset();
watch
.
reset
(
);
cg.apply(x1,b1,r1
);
cg
.
apply
(
x1
,
b1
,
r1
);
if(!r1.converged && rank==0)
std::cerr<<" Cg solver did not converge!"<<std::endl;
*/
//std::cout<<"CG solving took "<<watch.elapsed()<<" seconds"<<std::endl;
}
if
(
!
r1
.
converged
&&
rank
==
0
)
std
::
cerr
<<
" Cg solver did not converge!"
<<
std
::
endl
;
template
<
int
BSStart
,
int
BSEnd
,
int
BSStep
=
1
>
struct
AMGTester
{
static
void
test
(
int
N
,
int
coarsenTarget
)
{
testAmg
<
BSStart
>
(
N
,
coarsenTarget
);
const
int
next
=
(
BSStart
+
BSStep
>
BSEnd
)
?
BSEnd
:
BSStart
+
BSStep
;
AMGTester
<
next
,
BSEnd
,
BSStep
>::
test
(
N
,
coarsenTarget
);
}
}
;
//std::cout<<"CG solving took "<<watch.elapsed()<<" seconds"<<std::endl;
template
<
int
BSStart
,
int
BSStep
>
struct
AMGTester
<
BSStart
,
BSStart
,
BSStep
>
{
static
void
test
(
int
N
,
int
coarsenTarget
)
{
testAmg
<
BSStart
>
(
N
,
coarsenTarget
);
}
};
int
main
(
int
argc
,
char
**
argv
)
{
MPI_Init
(
&
argc
,
&
argv
);
MPI_Errhandler
handler
;
MPI_Errhandler_create
(
MPI_err_handler
,
&
handler
);
MPI_Errhandler_set
(
MPI_COMM_WORLD
,
handler
);
int
N
=
1000
;
int
coarsenTarget
=
1200
;
if
(
argc
>
1
)
N
=
atoi
(
argv
[
1
]);
if
(
argc
>
2
)
coarsenTarget
=
atoi
(
argv
[
2
]);
AMGTester
<
1
,
5
>::
test
(
N
,
coarsenTarget
);
AMGTester
<
10
,
10
>::
test
(
N
,
coarsenTarget
);
MPI_Finalize
();
}
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