-
Notifications
You must be signed in to change notification settings - Fork 15
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
Melt windows fix #137
base: main
Are you sure you want to change the base?
Melt windows fix #137
Conversation
Discussion:
|
e9db293
to
36cad91
Compare
36cad91
to
476d626
Compare
Integer size for FTorch can now be controlled using parameter `ftorch_int`. Currently, the default is set to `int32` but this could be changed if required. This fixes an issue on windows with the latest version of ifx/ifort which builds with a different integer type leading to the following error: ``` error #6284: There is no matching specific function for this generic function reference. [TORCH_TENSOR_FROM_ARRAY] in_tensors(1) = torch_tensor_from_array(in_data, tensor_layout, torch_kCPU) -------------------^ ```
476d626
to
7856a33
Compare
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 all looks reasonable and in agreement with what we discussed in the meeting, thanks!
The remaining thing to do is to document this, as mentioned in the checklist for the PR.
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.
Discussed in meeting, small comments on looking at the code, looks like just docs left.
src/CMakeLists.txt
Outdated
if (WIN32) | ||
set (CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS TRUE) | ||
set (BUILD_SHARED_LIBS TRUE) | ||
endif () | ||
|
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.
A small comment to explain presence of this clause?
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.
done in b3b50a1
src/ftorch.fypp
Outdated
@@ -514,7 +516,7 @@ contains | |||
integer(c_int), parameter :: c_dtype = ${enum_from_prec(PREC)}$ !! Data type | |||
integer(c_int64_t) :: strides(${RANK}$) !! Strides for accessing data | |||
integer(c_int), parameter :: ndims = ${RANK}$ !! Number of dimension of input data | |||
integer :: i | |||
integer(ftorch_int) :: i |
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.
integer(ftorch_int) :: i | |
integer(ftorch_int) :: i |
Nit
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 did one better. See 594e938. Hope you like it 🤞
thanks. Just done in d64358c |
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.
Thanks for adding the docs, @TomMelt. Just one minor request then good to go!
integer, parameter :: ftorch_int = int64 ! set integer size for FTorch library | ||
``` | ||
|
||
Finally, you will need to run `fypp` e.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 guess users may also need to install this because it isn't in the set of minimal requirements.
|
||
Finally, you will need to run `fypp` e.g., | ||
```bash | ||
fypp src/ftorch.fypp > src/ftorch.F90 |
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.
Not important but FYI this also works without the >
.
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.
Thanks @jwallwork23 TIL.
fixes #124
Windows was not previously exporting the library symbols and creating the
dll
correctly.This is now resolved by the following addition to
CMakeLists.txt
FTorch/src/CMakeLists.txt
Lines 6 to 9 in 7856a33
Furthemore, there was an issue that the library was built with a different integer size than that used when compiling example programs, despite no difference in compiler option. We have now forced the library to use
int32
explicitly. This can be modified by the user, modifying the following lineFTorch/src/ftorch.fypp
Line 34 in 7856a33
Tasks:
int64
/int32
issue properly (we have decided to build int32 by default. Can be overridden by user.