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

Melt windows fix #137

Merged
merged 22 commits into from
Dec 10, 2024
Merged

Melt windows fix #137

merged 22 commits into from
Dec 10, 2024

Conversation

TomMelt
Copy link
Member

@TomMelt TomMelt commented Jun 19, 2024

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

if (WIN32)
set (CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS TRUE)
set (BUILD_SHARED_LIBS TRUE)
endif ()

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 line

integer, parameter :: ftorch_int = int32 ! set integer size for FTorch library

Tasks:

  • fix cmake windows build issue
  • fix int64/int32 issue properly (we have decided to build int32 by default. Can be overridden by user.
  • update documentation to reflect new changes

@TomMelt TomMelt added the bug Something isn't working label Jun 19, 2024
@TomMelt TomMelt self-assigned this Jun 19, 2024
@jatkinson1000
Copy link
Member

jatkinson1000 commented Sep 9, 2024

Discussion:

Copy link
Contributor

@jwallwork23 jwallwork23 left a 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.

Copy link
Member

@jatkinson1000 jatkinson1000 left a 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.

@TomMelt
Copy link
Member Author

TomMelt commented Nov 19, 2024

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.

thanks. Just done in d64358c

Copy link
Contributor

@jwallwork23 jwallwork23 left a 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!

Copy link
Member

@jatkinson1000 jatkinson1000 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Couple of suggestions on phrasing, but not blocking.
Should be OK with this being added once #168 is approved and merged

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)
-------------------^
```
TomMelt and others added 4 commits December 10, 2024 13:26
fixes [#183](#183)

There is an issue when building on mac (arm_64) or windows. The version
of `libtorch` exposes a torch tensors shape (`t->sizes().data()`) as a
`const long long int*` instead of just a `const long int*` like on linux
and mac (x86).

This commit adds preprocessor macro to switch between implementations
automatically detecting the correct version at CMake build stage.
@TomMelt
Copy link
Member Author

TomMelt commented Dec 10, 2024

the only test that fails is in the static analysis when running fortitude. This will be fixed separately by #205

@TomMelt TomMelt merged commit b8ccc90 into main Dec 10, 2024
5 of 6 checks passed
@TomMelt TomMelt deleted the melt-windows-fix branch December 10, 2024 15:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working hackathon
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Windows Installation Issue
3 participants