Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

- Intel Community
- Software
- Software Development SDKs and Libraries
- Intel® oneAPI Math Kernel Library
- fortran example for routine mkl_sparse_?_export_csr

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page

qdu

Beginner

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

07-15-2020
08:43 AM

259 Views

fortran example for routine mkl_sparse_?_export_csr

Hello,

I am looking for help about how to implement the mkl Inspector-Executor sparse routine "mkl_sparse_?_export_csr" in Fortran. I found the example in C but not in Fortran. In fact, I am using the Intel version 2017 where no example is given for this routine while I saw for version 2020, there is an example in Fortran f90.

Could anyone post the example here? I am confused by the input "rows_start" .. which is required as a pointer to array. No idea about how to implement this kind of pointer in Fortran.

Thank you in advance !

qdu

Link Copied

5 Replies

mecej4

Black Belt

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

07-15-2020
09:13 AM

255 Views

There is an example, sparse_d_export_csr.f90, in the MKL examples\spblasf\source in the MKL2018 and later distributions.

This example was not present in MKL 2016, and the export routines are not present in the MKL 2016 libraries. The MKL 2018 example failed to be built with this older version of MKL.

I suspect that your MKL 2017 libraries do not contain the sparse matrix export routines either, but you can find out for yourself by using DUMPBIN.

In general, you should not expect to find newly added routines and capabilities in older versions of software. My recommendation is that you obtain the current version of MKL.

qdu

Beginner

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

07-16-2020
07:36 AM

241 Views

Thank you for your reply.

But the problem is I cannot update the version of Intel as I like since I am using my school's PC and all the softwares were installed by school's IT departement. They have indeed tested the compatibility of this version 2017 with others (like Abaqus, IDE VS..) so this version is the most updated and stable for them..

In fact, what I am looking for is an example of the routine "mkl_sparse_?_export_csr". I am certain that this routine is included in the MKL library of version 2017 (I found the interface in the file "mkl_spblas.f90"), I can also run this routine in my codes, but the results confused me...

Maybe I didn't explain well. For this routine, the input "rows_start", "rows_end", "col_indx", "values" are all required to be a pointer to array.. This pointer is simple to be implemented using C (adress of parameter using &) but I cannot find out how to implement in Fortran. Actually, in the interface "mkl_spblas.f90", these parameters are declared as "integer/real, intent(inout), dimension(*) :: ...". I am not clear how to deal with this kind of declaration using a pointer.. (there is no "target" attribute..)

So if you don't have the example in hand, any explanation will also be appreciated !

Thank you in advance.

qdu

mecej4

Black Belt

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

07-16-2020
08:40 AM

237 Views

If you have a suitable version of MKL installed, there will be three zip files in the .../MKL/examples directory. You can copy the zip file to your own directory and extract the example that you want from it, or extract all the files in the zip if you prefer.

The terminology used ("pointer", "index", etc.) can be confusing, and the confusion is made worse by the choice of the MKL document writers to describe zero- and one-based indexing simultaneously. Furthermore, the two arrays pointerB and pointerE contain redundant information, but that was a design decision made by whoever originated the SparseBlas routines.

I suggest that you look at the example matrix and the "pointer" array values at

(scroll down till you see the heading "Storage Arrays for a Matrix in CSR Format")

qdu

Beginner

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

07-22-2020
01:58 AM

198 Views

@mecej4 Thanks for your reply.

I have studied the format CSR of sparse matrix and known the definition of its different parameters (pointerB, pointerE, etc).

I found finally the example and the updated interface in newer version of MKL (2019). In new interface, declarations are modified from (e.g. for rows_start) "integer, intent(inout), dimension(*) :: rows_start" to "type(c_ptr), intent(inout) :: rows_start" and so in the given example, we define "type(c_ptr) :: rows_start_c" and "integer, pointer :: rows_start_f(:) " and use the routine "c_f_pointer" to convert pointer from C to Fortran.

Well, maybe it's better to use a type "c_ptr" to achieve this export, but I really want to know how to use the older routine (I mean like in version 2017 I'm using, with the declaration "dimension(*)..." in interface). There must be a method, I suppose.. considering when you Intel genius guys were constructing this old routine.

Thank you for your attention.

qdu

Gennady_F_Intel

Moderator

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

07-16-2020
06:28 AM

245 Views

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

For more complete information about compiler optimizations, see our Optimization Notice.