- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi All,
Could someone please point me to a tutorial for setting up the Fast Poisson Solver, provided by the MKL, in Fortran90 please?
I've been reading the manual, however most of the examples are in C so I'm very confused and getting many different errors.
I'm a complete beginner with MKL, so I'm not entirely sure how to implement this at all.
The grid I'm using is 2D and square. I'm trying to solve the electrostatic Poisson equation. The outside boundaries of the entire domain are set to zero. There will be two regions within the domain that have fixed potentials applied. The rest of the domain needs to be solved using Poisson's equation.
I've found quite a few topics on f90 Poisson solvers, but could not find any beginner guides.
If none exist, would it be possible for someone to explain how to get started with this?
I'm using an HPC with MKL already installed, as well as parallel studio.
Thanks in advance!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Joseff,
Let me give you the steps that I've followed to run the sample code (Double precision 2D Helmholtz - I presume this is what you are trying).
> ifort -c /opt/intel/oneapi/mkl/2022.1.0/include/mkl_dfti.f90
> ifort -c /opt/intel/oneapi/mkl/2022.1.0/include/mkl_poisson.f90
> ifort -qmkl d_Helmholtz_2D_f.f90
-qmkl is the quick linking option used to link with mkl with Intel compilers. You can refer to the links which I've mentioned in my previous post.
Since you are using ifort from the parallel studio it would be -mkl I guess.
Here is the screenshot of the output after successful compilation.
Hope this helps in resolving the issue.
Regards,
Vidya.
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Joseff,
Thanks for reaching out to us.
>>Could someone please point me to a tutorial for setting up the Fast Poisson Solver, provided by the MKL, in Fortran90 please?
Here is the link for MKL developer reference in Fortran in case you miss it.
Poisson Solver Implementation:
There are some sample programs that come with MKL. If you install oneAPI Base Toolkit in your system, the folder which contains the examples would be under the installed MKL directory in your system. Below is the location of samples in my windows system.
C:\Program Files (x86)\Intel\oneAPI\mkl\2022.0.2\examples\examples_core_f\f\pdepoisson\source
And for Linux the location of the samples:
/opt/intel/oneapi/mkl/2022.1.0/examples/f/pdepoisson/source
Here is the link to download oneAPI Base Toolkit:
https://www.intel.com/content/www/us/en/developer/tools/oneapi/base-toolkit-download.html
So we suggest you go through the examples and please get back to us if you face any issues.
You can go through the following link https://www.intel.com/content/www/us/en/develop/documentation/onemkl-linux-developer-guide/top/linking-your-application-with-onemkl/linking-quick-start.html which gives some details about compiling and linking your application with oneMKL.
Regards,
Vidya.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Vidya,
Many thanks for your support - the f90 example is exactly what I was after and should hopefully help me loads!
Unfortunately I'm still having issues getting the example to run.
I have compiled the mkl_dfti module (which automatically compiled the mkl_dft_type module). I was then able compile the mkl_poisson module fine too.
Despite this, when attempting to run the example program (double precision 2D Poisson), I get the following errors:
/tmp/ifortHWaXt8.o: In function `MAIN__':
undefined reference to `d_init_helmholtz_2d_'
undefined reference to `d_commit_helmholtz_2d_'
undefined reference to `d_helmholtz_2d_'
undefined reference to `free_helmholtz_2d_'
undefined reference to `mkl_free_buffers_'
undefined reference to `mkl_free_buffers_'
This led to the failure of the main program code being compiled.
Do you know what could be causing this? I haven't modified any of the example main program source code, neither have I modified any of the modules. As far as I can tell, I shouldn't have to modify anything in order to get the example to run?
I get the feeling I am likely forgetting other important modules, but I can't seem to find any other references to other modules in any of the source codes. I cannot seem to locate the mkl_dft_type module source code in the 'includes' section, nor the 'examples' folder, however it automatically compiled when I compiled the mkl_dfti module. Therefore I assume this module requires other MKL components that I'm unaware of?
This is the batchfile I'm using on the HPC (some names removed for NDA purposes):
#!/bin/bash --login
###
#SBATCH --job-name=XXX
#SBATCH --output=bench.out.%J
#SBATCH --error=bench.err.%J
#SBATCH --nodes=1
#SBATCH --ntasks=8
###
module load intel/parallel_studio_2020u1
cd /XXX
ifort -r8 -fpp -mcmodel=medium -o XXX -qopenmp XXX.f90
./XXX
(I have tried removing the openMP flag but the same error appears)
Do you have any idea how I could get this up and running? Once I get the example working then it shouldn't be too difficult for me to adapt it to fit my own simulations.
Many thanks for your help!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Joseff,
Let me give you the steps that I've followed to run the sample code (Double precision 2D Helmholtz - I presume this is what you are trying).
> ifort -c /opt/intel/oneapi/mkl/2022.1.0/include/mkl_dfti.f90
> ifort -c /opt/intel/oneapi/mkl/2022.1.0/include/mkl_poisson.f90
> ifort -qmkl d_Helmholtz_2D_f.f90
-qmkl is the quick linking option used to link with mkl with Intel compilers. You can refer to the links which I've mentioned in my previous post.
Since you are using ifort from the parallel studio it would be -mkl I guess.
Here is the screenshot of the output after successful compilation.
Hope this helps in resolving the issue.
Regards,
Vidya.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Vidya,
Brilliant, thank you so much for your help! All working now.
I'd manually compiled the modules before, but I'd missed off the -mkl flag!
For future reference if anyone is interested, I still needed to modify my batchfile slightly from the above. Vidya's worked perfectly, however the output was in binary format, so it needed tinkering for it to display properly in our HPC's output file system. Obviously, the above would presumably work perfectly fine on a standard PC.
To get my outputs to be human readable, this is the batch file I used. Again, some information (names and file locations) removed for NDA purposes, but the general format should be useful.
#SBATCH --job-name=XXX
#SBATCH --output=bench.out.%J
#SBATCH --error=bench.err.%J
#SBATCH --nodes=1
#SBATCH --ntasks=8
###
module load intel/parallel_studio_2020u1
cd /XXX
ifort -c /XXX/include/mkl_dfti.f90
ifort -c /XXX/include/mkl_poisson.f90
ifort -mkl -r8 -fpp -mcmodel=medium -o XXX XXX.f90
./XXX
Vidya's final command 'ifort -qmkl d_Helmholtz_2D_f.f90' allowed the program to run and produce the results, but it wasn't configured to output human readable data on our system. Therefore, I had to add the command lines:
ifort -mkl -r8 -fpp -mcmodel=medium -o XXX XXX.f90
./XXX
Where the first line compiles, and the second line executes the program. Therefore, the program prints appear in our 'bench.out' file system. Naturally, not necessary if using a standard PC.
Many thanks for your help Vidya!!! Hopefully this is of some benefit to anyone else getting started on Fortran MKL on HPCs.
All the best,
Joseff
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Joseff,
Glad to know that it works.
As the issue is resolved, could you please confirm if we can close this thread from our end?
Regards,
Vidya.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Joseff,
Thanks for accepting the solution.
As the issue is resolved we are closing this thread. Please post a new question if you need any additional assistance from Intel as this thread will no longer be monitored.
Have a Great Day!
Regards,
Vidya.
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page