Forum Message

 

 

We have moved the forum to https://forum.ngsolve.org . This is an archived version of the topics until 05/05/23. All the topics were moved to the new forum and conversations can be continued there. This forum is just kept as legacy to not invalidate old links. If you want to continue a conversation just look for the topic in the new forum.

Notice

The forum is in read only mode.

solveM for DG space on subdomain failed

More
5 years 1 week ago #1566 by Guosheng Fu
Hello, I would like to optimize Joachim's DG code for acoustics with PML in this link
ngsolve.org/forum/ngspy-forum/115-bounda...or-time-domain-waves

The first thing I would like to do is to define the phat and uhat variables only in PML domain, which I can do like the following:
Code:
fes_uhat = VectorL2(mesh, order=k, definedon="pmlx|pmly|pmlxy")

But this DG space on subdomain does not come with solveM option, If I run the following line,
Code:
fes_uhat.SolveM(...)

It returns me the message that
Code:
mass matrix certainly not diagonal for element N5ngfem13ScalarDummyFEILNS_12ELEMENT_TYPEE10EEE
This seems to be a bug....
More
5 years 1 week ago #1567 by joachim
Hi Guosheng,

the coming nightly will not crash in your test case. Furthermore, the SolveM - function supports now also a definedon=region argument such that the dummyFEs will not be called at all. Still needs some testing.

Pls keep us informed concerning your optimizations ....

Best, Joachim
More
5 years 1 week ago #1568 by Guosheng Fu
Hi Joachim,

Thank you.
To make the code a bit faster, I can only think of these two more changes:
(1) changed the element-wise boundary integration to skeleton-based edgewise integration. This gives me a little bit speed up (I was expecting more since we looping over edges now...anyway this is fine)
(2) use the compile flag to evaluate symbolicBFIs more efficiently. (This cause some trouble!!! It did give me speed-up when running in multi-threading without mpi, but it also slowed down the code when running in mpi in comparison with the code without the compile flag)

Now, I have two questions
concerning (1), is there a more efficient way to loop over edges of a subdomain? Currently, I can only do
Code:
element_boundary=True, definedon=mesh.Materials(...)
I guess I need to flag all edges of the subdomain properly, then use a definedon flag, something like
Code:
VOL, skeleton=True, definedon=???
But I don't know how to do it correctly.... if this is too complicated, I might just stick with element_boundary formulation since the speed-up using skeleton-based formulation is quite insignificant.

concerning (2), I am a bit confused about when to use the compile flag for speeding up. I've read the note
ngsolve.org/user-meeting2017/talks/hochsteger.pdf
But is still quite confused.
In my multi-threading test, I found .Compile(True, True) works better than .Compile(), which didn't give me any speed up... what's their difference, should I always stick with .Compile(True,True)? or (False, True)? (False, False)??
Then, the more serious question is that why the MPI version slowed down the code using compile flag? Should I just stick with the form without compile instead?

Best,
Guosheng
More
5 years 6 days ago #1576 by Guosheng Fu
Concerning the compile question, attached is the code that solves a time domain wave equation
Line 42 is the flag to use .compile() or not.

I ran the following line,
Code:
mpirun -np 64 ngspy testCompiler.py
the elapsed time is about 3.0 s for cc = True, and about 1.5 for cc = False (I got slower result with compile(True, True))

I then run the following line (multi-threads with 64 cores)
Code:
ngspy testCompiler.py
the elapsed time is about 1.2 s for cc = True, and about 2.0 for cc = False
(I got faster result with compile(True, True))
Attachments:
Time to create page: 0.155 seconds