-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
XPU and MPS take 3 #276
base: main
Are you sure you want to change the base?
XPU and MPS take 3 #276
Conversation
4aa9a4a
to
55b929f
Compare
. ftorch_venv/bin/activate # Uses .clang-tidy config file if present | ||
fortitude check src/ | ||
. ftorch_venv/bin/activate | ||
fortitude check --ignore=E001,T041 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.
To get the Fortran linting check to pass, I had to ignore errors of the form reported in https://github.com/Cambridge-ICCS/FTorch/actions/runs/13240946802/job/36956002877, as well as ones of the form
src/ftorch.F90:153:57: T041 'tensor_shape' has assumed size
|
151 | type(c_ptr), value, intent(in) :: data
152 | integer(c_int), value, intent(in) :: ndims
153 | integer(c_int64_t), intent(in) :: tensor_shape(*)
| ^ T041
154 | integer(c_int64_t), intent(in) :: strides(*)
155 | integer(c_int), value, intent(in) :: dtype
because we established that the cases where we use assumed size in ftorch.F90
are required.
Offline testing for CUDA version of MultiGPU example with 2 devices passed on Ampere. In the queue for XPU testing on PVC. |
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 I have only done a quick pass of this so far and will need to schedule time for a closer look, but I suspect you know my first comment - can you update the docs at utils/README
etc. to reflect the new args and usage of pt2ts?
I would also like to see it documented somewhere how the device enums are managed from CMake. Perhaps under the developer docs. As, whilst a very nifty solution, it's slightly abstract if you are not the one who came up with it 😉
Also looks like you may want a rebase after #268 |
e6f8779
to
838f3ae
Compare
Oh, I'd forgotten about that README actually. Addressed here 50bd953.
Ah yes... done in 838f3ae.
Done! |
I don't understand why the clang-tidy errors didn't crop up previously...? For one of them, I can fix with +#include <stdbool.h> For the device related one, I could fix with +// NOTE: These need to be defined here for clang-tidy to pass
+#ifndef GPU_DEVICE_NONE
+#define GPU_DEVICE_NONE 0
+#endif
+#ifndef GPU_DEVICE_CUDA
+#define GPU_DEVICE_CUDA 1
+#endif
+#ifndef GPU_DEVICE_XPU
+#define GPU_DEVICE_XPU 12
+#endif
+#ifndef GPU_DEVICE_MPS
+#define GPU_DEVICE_MPS 13
+#endif (although would prefer to avoid duplicating these codes) But the other torch/script one - is clang-tidy meant to be compiler-aware or something? |
I have just run this on a Mac using Mps and made the relevant tweaks to get it to work. I'll look to schedule time to review the rest of this. |
…gs for running fortran on all devices.
4149316
to
c863cc7
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.
A few very minor suggestions but otherwise those additions looks good - thanks for testing on MPS @jatkinson1000. Still waiting for my XPU job to run.
Co-authored-by: Joe Wallwork <22053413+jwallwork23@users.noreply.github.com>
Good news - test passed on 2 XPU devices on Dawn! 🥳 |
Re-tested on Dawn with latest version of branch - all good |
@@ -165,7 +165,7 @@ To build and install the library: | |||
| [`CMAKE_INSTALL_PREFIX`](https://cmake.org/cmake/help/latest/variable/CMAKE_INSTALL_PREFIX.html) | `</path/to/install/lib/at/>` | Location at which the library files should be installed. By default this is `/usr/local` | | |||
| [`CMAKE_BUILD_TYPE`](https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html) | `Release` / `Debug` | Specifies build type. The default is `Debug`, use `Release` for production code| | |||
| `CMAKE_BUILD_TESTS` | `TRUE` / `FALSE` | Specifies whether to compile FTorch's [test suite](https://cambridge-iccs.github.io/FTorch/page/testing.html) as part of the build. | | |||
| `ENABLE_CUDA` | `TRUE` / `FALSE` | Specifies whether to check for and enable CUDA<sup>3</sup> | | |||
| `GPU_DEVICE` | `NONE` / `CUDA` / `XPU` / `MPS` | Specifies the target GPU architecture (if any) <sup>3</sup> | |
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.
It's probably worth at least mentioning Intel/Mac GPUs in the GPU Support
section of the README too?
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.
Ah, good point! Addressed in 0897b20.
Closes #127.
Builds upon #125 and #209.
(Contains changes from #268 so that will need to be merged first.)
This PR adds support XPU and MPS. Unfortunately, it ended up requiring an overhaul of the
pt2ts
scripts, too.Notable changes:
ENABLE_CUDA
to the more general and extensibleGPU_DEVICE=<NONE/CUDA/XPU/MPS>
.argparse
for reading command line arguments into Python scripts, rather thansys.argv
.Checklist