-
Notifications
You must be signed in to change notification settings - Fork 0
Proposition: changes to hash function tests #6
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
Conversation
@wclodius2 I modified the Now it ould be nice to get that into CMake, but my knowledge in CMake is very limited. Any ideas? |
@wclodius2 the test that includes C/C++ can be compiled with Intel OneAPI 2021 Edit: it comiples, but fails for nmhash32 as you mentioned it. |
@jvdp1 so far so good. FWIW I first did a single application version of the validation code before the one currently in the distribution, but the Fortran wrappers for the C/C++ code resulted in additional files. I could a new subdirectory with the single application code. |
FWIW I used
However i have upgraded to A Mac Ibook with an M1 chip. While the M1 is nominally "faster" than current Intel processors, ifort would run emulated and I suspect will be several times slower than when I used my Intel based Mac. Given that I remember fort taking over an hour to compile the standard library on my previous machine, I am now reluctant to use ifort to compile the full standard library. |
Given the failure with ifort I don't think it can be fully integrated with the standard library. Trying to compile and run it with the rest of the code will cause it to fail on the ifort tests. |
For both
Actually the preprocessed sources are highly similar between Intel and GCC. The main differences are related to alignment as far as I can understand the code. It would be good to understand why it fails. i.e., Is it in the C side or in the Fortran side with the Intel compilers? |
It is my impression that on Intel processors alignment doesn't natter for scalar expressions, but does matter for SIMD or AVE operations. Could
expand to SIMD or AVE operation on Intel processors? It is straight forward, but tedious, to translate my |
@awgwk any idea what could be the problem?
I already started here. Actually, in this Makefile, only one excecutable is generated, instead of the 3 aplications. The Makefile.manual at the root of the stdlib directory should define the compilers (either |
What I was suggesting was that, because the application |
I found that ifort 2021.2.0 compiles stdlib in a reasonable time on my M1 Ibook. When I then try to compile my three executable validation code, for the C/C++
So at least for this version of the OneAPI compiler suite running on an M1 Ibook |
CC = gcc | ||
CXX = g++ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should the compilers be hardwired here, or should they be determined from environmental variables. Hardwiring this doesn't guarantee it will compile if the Library proper is compiled with ifort.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, it shouldn't be hardwired. Once the issue is fixed with Intel OneAPI, we can improve this Makefile.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am now convinced that we cannot fix the program's problems with OneAPI. They will have to be fixed by Intel, and the fix will likely only apply to later versions of their compiler suite. In my three executable version of the validation test, the error message implies that the compiler's header files tell the preprocessor that ___builtin_rotateleft32
is defined and hence should be used for the left circular shift, but the linker cannot find the corresponding function in the compiler library.
test_hash_functions: test_hash_functions.f90 generate_hash_arrays.o libc_hash.a | ||
$(FC) $(FFLAGS) $(CPPFLAGS) -L. -o $@ $^ $(LDFLAGS) -lc_hash -lstdc++ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks as if you are still going to write the hash files and then read them, while they could be generated and used without the intermediate transfers to and from a binary file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is indeed the case. My skills in C/C++ are not that high, and I didn't want spend time in something that might not work (especially for Intel OneAPi). If we can get it work, then I think it will be worthwhile that we spend time to improve this approach.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall the proposed changes are reasonable, but we have to explicitly decide between three choices:
- Fix the C conditional compilation code for the nmhashes so it never tries to use
___builtin_rotateleft32
; or - Add constraints in the Makefile so that it will only automatically run the hash validation codes if the GCC compiler suite is being used (I am not an expert on this aspect of Makefiles); or
- Only allow the hash validation codes to be run manually.
CC = gcc | ||
CXX = g++ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am now convinced that we cannot fix the program's problems with OneAPI. They will have to be fixed by Intel, and the fix will likely only apply to later versions of their compiler suite. In my three executable version of the validation test, the error message implies that the compiler's header files tell the preprocessor that ___builtin_rotateleft32
is defined and hence should be used for the left circular shift, but the linker cannot find the corresponding function in the compiler library.
@@ -14,6 +14,7 @@ testdrive.F90: | |||
all test clean:: | |||
$(MAKE) -f Makefile.manual --directory=ascii $@ | |||
$(MAKE) -f Makefile.manual --directory=bitsets $@ | |||
$(MAKE) -f Makefile.manual --directory=hash_functions_perf $@ | |||
$(MAKE) -f Makefile.manual --directory=hash_functions $@ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe that this will automatically try to run the tests for the hash validation codes, and currently fail if the library is compiled with OneAPI. I believe we have three choices:
- Fix the C conditional compilation code for the nmhashes so it never tries to use
___builtin_rotateleft32
; or - Add constraints in the Makefile so that it will only automatically run the hash validation codes if the GCC compiler suite is being used (I am not an expert on this aspect of Makefiles); or
- Only allow the hash validation codes to be run manually.
Thank you. I guess we can start the meeting with this topic. However, there is no problem if you cannot join it. No worries! |
It looks like Hawaii does not observe Daylight Savings Time, and the meeting will be at 10 AM my time, so I won't be able to attend. |
No problems. Do you mind if I introduces it for discussion? Or do you prefer to be there (and then I will not discuss it)? |
It looks like your changes to |
I figure introducing it ASAP is more important than my being there. |
Inspecting the two check failures:
The problem seems to be the "undefined reference to
This, to me, implies that on the test processor with macOS-latest running |
|
Currently the C/C++ source code are only for the tests. The stdlib library in itself does not require the C/C++ codes, because @wclodius2 translated them. Does fpm need to compile all the tests?
@awvwgk I modified the CI.yml for Ubuntu, such that Intel C/C++ are installed in the workflow. But my attempts for MacOS were unsuccessful :( |
I see, still if the test links against the C/C++ source than those must be present and compiled. You can always scrub the validation test files from the deployment by adding them to the Lines 29 to 34 in 1c3a707
I think I have a working install for both Fortran and C/C++ compilers somewhere... maybe this one: |
This would be my first time approving a PR. What steps do I need to take to approve @jvdp1's PR for my PR? |
During the Monthly call, there was no objection against this approach for testing. @awvwgk repeated some remarks he already mentioned here and gave some explanations about the
Based on that, I will continue to work on the different CIs.When I will be ready, I will update the PR to |
@jvdp1 thanks! |
@wclodius2 Following @awvwgk 's suggestions, I modified the script for the fpm deployment. I tried to modify the CI.yml for MacOS + Intel, but I was unsuccessfull. At this stage, I propose to merge this PR into your branch (if you agree with my changes, of course). So. they will appear in the PR in stdlib, and we can discuss there about the last issue (at least for me; i.e. Mac + Intel). |
@jvdp1 I agree with merging this PR into my branch. |
I have done the merge. |
@wclodius2
Here are some changes:
hash_functions
tohash_functions_perf
validation
to the directoryhash_functions
test_hash_functions.f90
(aim: same ashash_validity_test.f90
Proposition: for the next step: replace
hash_validity_test.f90
bytest_hash_function.f90
.It would be nice to get the tests running for all cases, without the need of the 3 different programs (could it be possible that
generate_hash_array
is called within the test_hash_fucntion.f90 on all platforms?). @awvwgk may have some ideas ;)Let discuss and try to get the tests running within the CI.