Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing MKL Lapack functions #1388

Closed
blueberry opened this issue Jul 15, 2023 · 14 comments
Closed

Missing MKL Lapack functions #1388

blueberry opened this issue Jul 15, 2023 · 14 comments

Comments

@blueberry
Copy link

JavaCPP presets 1.5.9 are missing MKL LAPACK norm operations: slansb, dlansb, slangb, dlangb, slantb, dlantb (maybe others too, I'll report if I encounter such cases).

These are standard LAPACK functions, and are listed in both LAPACK and MKL documentation, such as:

https://www.intel.com/content/www/us/en/docs/onemkl/developer-reference-fortran/2023-0/langb.html

I couldn't find them listed in JavaCPP MKL preset source, so I'm not sure whether they are missing for a specific reason, or is it purely by chance. BTW, I used them in my C code, they are in MKL headers, and they work as expected in MKL...

@saudet
Copy link
Member

saudet commented Jul 16, 2023

The mkl_lapack.h file is huge and it didn't used to be possible to compile the generated code. I tried again in commit ccfa8af, but the build machines still don't have enough memory. As we can see from the Windows build log though, a whole lot of symbols don't actually exist, so we need to find a way to prune them. But if the only functions you're interested in are the ones you mention above, you could copy the declarations for those only and paste them in this class:
https://github.com/bytedeco/javacpp-presets/blob/master/mkl/src/main/java/org/bytedeco/mkl/presets/mkl_rt.java

If this sounds good, please open a pull request to that effect!

@blueberry
Copy link
Author

Yes, I only need these functions for now, and i might stumble upon a few others, but I will havea an explicit list. I will add them to that file. By copying the declarations, you mean that I should only add their names to the list at line 64?

@saudet
Copy link
Member

saudet commented Jul 16, 2023

No, I mean something like in commit 5bc74d8.

@blueberry
Copy link
Author

OK, I'll do the port I'm currently on, keep track of missing functions, and then I'll try to add them to javacpp presets by hand (or cry for help if there's something I can't follow).

@saudet
Copy link
Member

saudet commented Jul 18, 2023

I was able to get rid of all non-existent symbols by skipping all functions whose names end with an underscore, and I've managed to make it compile under Linux machines from GitHub Actions as well in commit b80d5a2, so could you give that a try and let me know if this works for you?

@blueberry
Copy link
Author

Sure! Should I expect this commit to be available in maven snapshots repository (I expect that would be in a couple of hours or sooner?) or I must clone javacpp repository and build it myself?

@saudet
Copy link
Member

saudet commented Jul 18, 2023

Please give it a try with the snapshots: http://bytedeco.org/builds/

@blueberry
Copy link
Author

Thanks! I've updated my project to 1.5.10-SNAPSHOT, but these functions are still missing from the current snapshot.
However, I've noticed that the timestamp on these snapshots is org/bytedeco/mkl-platform/2023.1-1.5.10-SNAPSHOT/mkl-platform-2023.1-1.5.10-20230718.130143-27.pom which i suppose stands for 13:01:43, that is BEFORE the last commit. Do you perhaps know when the snapshots get updated? Should it be in a few hours, or I better wait until tomorow?

BTW, here's the list of available XlanXX operations available in the snapshot that is currently available (the GB, SB, and TB versions are still missing).

Click on a completion to select it.
In this buffer, type RET to select the completion near point.

Possible completions are:
org.bytedeco.mkl.global.mkl_rt/LAPACKE_slange <sm> 	org.bytedeco.mkl.global.mkl_rt/LAPACKE_slange_work <sm>
org.bytedeco.mkl.global.mkl_rt/LAPACKE_slansy <sm> 	org.bytedeco.mkl.global.mkl_rt/LAPACKE_slansy_work <sm>
org.bytedeco.mkl.global.mkl_rt/LAPACKE_slantr <sm> 	org.bytedeco.mkl.global.mkl_rt/LAPACKE_slantr_work <sm>

@blueberry
Copy link
Author

Whoops, now I see that your commit was 7 hours ago, so it's probably included in the snapshot. But no, these functions are still missing.

@saudet
Copy link
Member

saudet commented Jul 18, 2023

I see them perfectly fine in this file:
https://raw.githubusercontent.com/bytedeco/javacpp-presets/mkl/mkl/src/gen/java/org/bytedeco/mkl/global/mkl_rt.java
Why do you say they are missing? I can't fix what isn't broken!

@blueberry
Copy link
Author

Sorry for missing that. It turns out that I expected these files to have the =LAPACKE_= prefix, like their cousins =LAPACKE_slange= etc, while they have been generated without that prefix.

Now I see that the un-prefixed versions are not available in http://bytedeco.org/javacpp-presets/mkl/apidocs/
that's why I didn't try to look them under these names. After a bit more looking, it seems that un-prefixed functions are "raw", while =LAPACK_xxxxx= are more Java-friendly with their primitive arguments. I'm puzzled why the generator hasn't produced =LAPACK_slangb= etc. but I don't mind it if it works.

The code that I had that uses these functions now had to be adapted to this "raw" way of calling. I'll do this tomorrow and report the results!

Thank you.

@blueberry
Copy link
Author

It works! (At least the cases that I tried so far). Thank you.

@saudet
Copy link
Member

saudet commented Jul 19, 2023

I don't see any LAPACK_slansb, etc functions in MKL. It's possible they got removed in newer versions. Please verify with Intel!

@blueberry
Copy link
Author

Yes. It turns out it's their mess. But, anyway, as far as JavaCPP is concerned, this now works as expected (well).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants