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

Unit tests (using pFunit) #76

Draft
wants to merge 15 commits into
base: main
Choose a base branch
from
Draft

Unit tests (using pFunit) #76

wants to merge 15 commits into from

Conversation

dorchard
Copy link
Member

@dorchard dorchard commented Nov 28, 2023

I have started putting in the infrastructure for us to write some unit tests using pFunit.

Create simple unit tests for main functions

  • Make the cmake portable; I fought a bit, but I don't know enough cmake. We need to be able to link the include directories for ftorch. At the moment the library and include paths need to be specified.
  • Test torch_tensor_from_blob (WIP)
  • Test torch_tensor_from_array
  • Test torch_tensor_zeros
  • Test torch_tensor_ones
  • Test torch_tensor_empty

Other things using torch_module_forward could be better with an integration test since it will need a lot of setup code anyway.

Closing this would fix #4

@dorchard
Copy link
Member Author

tests/test_ftorch.pf gives a start of a unit test for torch_tensor_from_blob

@TomMelt TomMelt added the enhancement New feature or request label Nov 30, 2023
@TomMelt TomMelt self-requested a review November 30, 2023 11:11
@jatkinson1000
Copy link
Member

Has this gone anywhere, or has it stagnated?

As far as I see it tests are the only thing preventing us from making a JOSS submission, and with at least 3 research projects using FTorch that are likely to publish soon this is now a matter of urgency.

For something minimal I was thinking we could have some CMake Test to build and run the SimpleNet example for a few different inputs and check the outputs are correct as an integration test.

@jatkinson1000 jatkinson1000 mentioned this pull request Apr 15, 2024
@dorchard
Copy link
Member Author

dorchard commented Apr 15, 2024

There's a start here, but it got a bit stalled as I could use some help with the cmake. Perhaps someone is able to work with me on this? @TomMelt ? Currently has an attempt at using CMake test and does a simple probe of the tensor conversion functions. I agree about running SimpleNet for some integration tests.

@jatkinson1000
Copy link
Member

jatkinson1000 commented Apr 15, 2024

Great, thanks @dorchard
Proposal from the morning is to briefly pause on this in favour of integration tests in #115 so we can make a JOSS submission, then return to this. We can certainly take a look and help with cmake, and the integration tests will use cmake so you might find those useful.

@TomMelt
Copy link
Member

TomMelt commented Apr 17, 2024

Hi @dorchard I'm more than happy to help with the CMake side of things. Let me know when is convenient.

git clone https://github.com/Goddard-Fortran-Ecosystem/pFUnit.git
mkdir pFUnit/build
cd pFUnit/build
cmake ..
Copy link
Contributor

@jwallwork23 jwallwork23 Nov 15, 2024

Choose a reason for hiding this comment

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

Try -DCMAKE_INSTALL_PREFIX=... to override the build path to avoid version number.

Copy link
Contributor

Choose a reason for hiding this comment

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

I tried this but it didn't seem to help. Pinning the pFUnit version for now (see fdc4d05).

@jwallwork23 jwallwork23 added the testing Related to FTorch testing label Nov 15, 2024
@jwallwork23
Copy link
Contributor

Perhaps this PR could just set up the infrastructure and add tests for the tensor constructors and we could address writing unit tests for the rest of FTorch in a follow-up PR?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request testing Related to FTorch testing
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Unit testing
4 participants