Skip to content
Snippets Groups Projects
Commit b24b42a2 authored by Christian Engwer's avatar Christian Engwer
Browse files

[amg] don't copy temporary data durint copy-construction

if on the initial AMG pre was called, it is currently it not necessary to
call pre on a copy of that AMG. This is a feature that is not required
by the Preconditioner interface and thus it nothing anybody can rely on.
We now don't copy the temporary data anymore.
parent e801e705
Branches feature/amg-memory-management
No related tags found
1 merge request!274Feature/amg memory management
Pipeline #17043 passed
......@@ -304,15 +304,7 @@ namespace Dune
coarseSmoother_(amg.coarseSmoother_),
category_(amg.category_),
verbosity_(amg.verbosity_)
{
#warning why do we need this? The vectors are re-created in AMG::pre(x)
if(amg.rhs_)
rhs_ = std::make_shared<Hierarchy<Range,A>>(*amg.rhs_);
if(amg.lhs_)
lhs_ = std::make_shared<Hierarchy<Domain,A>>(*amg.lhs_);
if(amg.update_)
update_ = std::make_shared<Hierarchy<Domain,A>>(*amg.update_);
}
{}
template<class M, class X, class S, class PI, class A>
AMG<M,X,S,PI,A>::AMG(const OperatorHierarchy& matrices, CoarseSolver& coarseSolver,
......
......@@ -96,15 +96,6 @@ void *solve(void* arg)
pthread_exit(NULL);
}
void *solve1(void* arg)
{
thread_arg *amgarg=(thread_arg*) arg;
*amgarg->x=0;
(*amgarg->amg).apply(*amgarg->x,*amgarg->b);
(*amgarg->amg).post(*amgarg->x);
return 0;
}
void *solve2(void* arg)
{
thread_arg *amgarg=(thread_arg*) arg;
......@@ -199,21 +190,6 @@ void testAMG(int N, int coarsenTarget, int ml)
}
void* retval;
for(int i=0; i < NUM_THREADS; ++i)
pthread_join(threads[i], &retval);
amgs.clear();
args.clear();
amg.pre(x, b);
amgs.resize(NUM_THREADS, amg);
for(int i=0; i < NUM_THREADS; ++i)
{
args[i].amg=&amgs[i];
args[i].b=&bs[i];
args[i].x=&xs[i];
args[i].fop=&fop;
pthread_create(&threads[i], NULL, solve1, (void*) &args[i]);
}
for(int i=0; i < NUM_THREADS; ++i)
pthread_join(threads[i], &retval);
......
......@@ -77,15 +77,6 @@ void *solve(void* arg)
pthread_exit(NULL);
}
void *solve1(void* arg)
{
thread_arg *amgarg=(thread_arg*) arg;
*amgarg->x=0;
(*amgarg->amg).apply(*amgarg->x,*amgarg->b);
(*amgarg->amg).post(*amgarg->x);
return 0;
}
void *solve2(void* arg)
{
thread_arg *amgarg=(thread_arg*) arg;
......@@ -173,21 +164,6 @@ void testTwoLevelMethod()
}
void* retval;
for(int i=0; i < NUM_THREADS; ++i)
pthread_join(threads[i], &retval);
amgs.clear();
args.clear();
preconditioner.pre(x, b);
amgs.resize(NUM_THREADS, preconditioner);
for(int i=0; i < NUM_THREADS; ++i)
{
args[i].amg=&amgs[i];
args[i].b=&bs[i];
args[i].x=&xs[i];
args[i].fop=&fop;
pthread_create(&threads[i], NULL, solve1, (void*) &args[i]);
}
for(int i=0; i < NUM_THREADS; ++i)
pthread_join(threads[i], &retval);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment