Re: [deal.II] Solving Step-74 by MPI

2022-08-14 Thread Wolfgang Bangerth

On 8/13/22 20:36, chong liu wrote:


Thank you for your reply. The link you shared is extremely helpful. I will try 
to extend Step-74 based on the ideas in Step-50.


If you make that work, it would actually be quite nice to have that as a code 
gallery program! Feel free to submit it as such (and/or talk to me about the 
process if you're unsure)!


Best
 W.

--

Wolfgang Bangerth  email: bange...@colostate.edu
   www: http://www.math.colostate.edu/~bangerth/

--
The deal.II project is located at http://www.dealii.org/
For mailing list/forum options, see 
https://groups.google.com/d/forum/dealii?hl=en
--- 
You received this message because you are subscribed to the Google Groups "deal.II User Group" group.

To unsubscribe from this group and stop receiving emails from it, send an email 
to dealii+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/dealii/3e1cfd2e-2b71-fd5c-8308-c6f1ea5282d5%40colostate.edu.


[deal.II] interface between dealii and matlab for data transfer (using mex files?)

2022-08-14 Thread Simon
Dear all,

my question is specific and regards the data transfer between Matlab and a 
dealii program. In a nutshell, I have to call my dealii program from Matlab 
with a Matlab vector as argument (my dealii program needs the values in the 
vector). I figured out that Mex files are one way to transfer data to a c++ 
program.


Here is a snippet of my Matlab script:

function res = fun(p,y)
s = call_my_dealii_program_passing_the_vector_p
res = s - y;
end

My issue is *how to pass the vector 'p' to the dealii program*.

There are MEX files which provide an interface between Matlab and C++ 
programs. A standard MEX file looks like this:

//file mymex.cpp
#include "mex.h"
//include some more header files from c++ or dealii
//write here the whole class definition and implemenation

void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
{
//this is the interface function to Matlab where also 'p' is passed
//in here, I will also create the instance of my dealii program to run the 
typical member //functions ike make_grid(), system_setup(),...
}

The above mex file is compiled within the Matlab gui using a c++ compiler 
(mex mymex.cpp). 

If I do not include any dealii headers in  mymex.cpp , the compilation 
works. 
However, including dealii headers results in a bunch of error messages when 
I compile the program in Matlab (mex mymex.cpp), because environment 
variables are not known to Matlab,...
Usually, I just call 'spack load dealii' followed by 'make run' to run my 
dealii programs, but I do not know how to 'forward' all this information to 
the Matlab compilation process.

All that said, has someone already worked with Mex files together with 
dealii?

I also appreciate other approaches to manage the data transfer between 
Matlab and dealii. 


Best
Simon

-- 
The deal.II project is located at http://www.dealii.org/
For mailing list/forum options, see 
https://groups.google.com/d/forum/dealii?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"deal.II User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to dealii+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/dealii/b047d35d-b3e3-465b-88d8-c708343086bfn%40googlegroups.com.


Re: [deal.II] Installation problem using spack

2022-08-14 Thread Marco Nawijn
Hi Jean-Paul,

I can confirm that the patch works like a charm. Thanks!

I now run into another issue, when running step-17. It fails with the 
following message:
  ***Memory allocation failed for SetupCtrl: maxvwgt. Requested size: 
137438953480 bytes

I did a quick search on the internet and it seems to be related to Metis 
5.1.0.

Just for information, when you run the example with MPI on 1 processor (so 
-np 1), the process runs fine. Any value >1 results in this error. The 
error itself makes sense because it requests a massive amount of memory (I 
am running on a laptop at the moment). A quick fix (based on what I found 
on the internet) is to downgrade the version of Metis. However, ideally for 
Deal-II newbies using straightforward laptops/workstations, it would be 
nice to just run `spack install dealii` and it just works. 

If there is anything I can do to help, I am more than willing to.

Kind regards,

Marco

  

On Thursday, August 11, 2022 at 9:30:41 PM UTC+2 Jean-Paul Pelteret wrote:

> Hi Marco,
>
> I've open a PR in Spack (https://github.com/spack/spack/pull/32079) that 
> backports the patches that we added to the development version to 9.4. Feel 
> free to try it and provide some feedback as to whether or not it works for 
> you.
>
> Best,
> Jean-Paul
>
> On Thursday, August 11, 2022 at 7:50:46 AM UTC+2 marco@colosso.nl 
> wrote:
>
>> Hi Daniel and Timo,
>>
>> Thanks for the feedback. The bug indeed seems to be the problem, since 
>> the spack HDF5 package is definitely build with MPI support. I first 
>> thought it was because by default spack doesn't seem to build HDF5 with C++ 
>> support, but that did not help (of course now I know why).
>>
>> Building without HDF5 would be an option for me for the short term, but I 
>> will first try to see if I can get it working.
>>
>> Again, I am pretty impressed by the spack. It works like a charm and it 
>> provides a lot of flexibility.
>>
>> Kind regards,
>>
>> Marco
>>
>> On Tuesday, August 9, 2022 at 7:27:38 PM UTC+2 Timo Heister wrote:
>>
>>> Your issue might be related to the bug 
>>> https://github.com/dealii/dealii/issues/14065 (see the discussion and 
>>> the linked PR that should solve the problem for deal.II master, but not 9.4)
>>>
>>> On Tuesday, August 9, 2022 at 1:23:55 PM UTC-4 d.arnd...@gmail.com 
>>> wrote:
>>>
 Marco,

 It appears that

 -- Insufficient hdf5 installation found: hdf5 has to be configured with 
 MPI support.

 is the problem. HDF5 has not been compiled with MPI support. Thus, you 
 can either try to make sure that HDF5 is built with MPI support or, in 
 case 
 you are not going to use HDF5 anyway, just disable the dependency.

 Best,
 Daniel

 On Tue, Aug 9, 2022 at 7:41 AM Marco Nawijn  
 wrote:

> Dear All,
>
> I run into an issue when trying to install dealii using spack. The 
> error is as follows:
>
>   Could not find the hdf5 library!
>
>   Insufficient hdf5 installation found!
>
>   hdf5 has to be configured with MPI support.
>
>   Please ensure that a suitable hdf5 library is installed on your 
> computer.
>
>   If the library is not at a default location, either provide some 
> hints for
>   autodetection,
>
> A complete log and additional information is provided in the two 
> attachments.
> I am a little lost at the moment because as far as I can tell, the 
> installation process finds the correct HDF5 folder (I checked the tags). 
> In 
> addition, I installed HDF5 using spack with MPI, C++ and Fortran support 
> (I 
> added the output of `tree` to the attachment). 
>
> I am a little at loss now, because I don't know what dealii is exactly 
> missing from the HDF5 installation.
>
> The system is just a laptop, so nothing cluster like.
>
> Just as a side note. I am pretty impressed with the easy and 
> flexibility of spack. All other dependencies installed without a hitch 
> (petsc, sundials, trilinios etc.).
>
> Does anybody have an idea of what the problem is?
>
> Any help is highly appreciated. 
>
> Marco
> P.S. I am a complete novice with dealii, but otherwise comfortable in 
> the linux eco-system.
>
> -- 
> The deal.II project is located at http://www.dealii.org/
> For mailing list/forum options, see 
> https://groups.google.com/d/forum/dealii?hl=en
> --- 
> You received this message because you are subscribed to the Google 
> Groups "deal.II User Group" group.
> To unsubscribe from this group and stop receiving emails from it, send 
> an email to dealii+un...@googlegroups.com.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/dealii/7383fcc8-af66-438f-b363-3aa1c9032d5en%40googlegroups.com
>  
>