cellpose icon indicating copy to clipboard operation
cellpose copied to clipboard

WIP: Enable (local) GPU testing

Open erjel opened this issue 4 years ago • 2 comments

Hi,

during my last development sessions on the code, I realized that the GPU implementation is a blind spot in the test routines. While github-hosted runners do not come with enabled GPU hardware, I believe that many developers/ users have access to GPUs (at least smaller/older ones which are perfectly fine for testing purposes). By providing the necessary configuration files, everyone could check their pull requests locally for bugs in the GPU code prior to a commit.

I already started with a corresponding tox configuration file for a previous pull request, and would like to share the work and to start the discussion.

My current setup:

  • tested Windows 10 and CentOS 7
  • Miniconda non-admin installation with default settings
  • Install tox-conda installation (for pytorch support) in base environment for testing
  • Use modified tox configuration (tox.ini vs tox-conda.ini) for testing the code on a GPU
conda activate base
pip install tox-conda
tox -c tox-conda.ini

Next steps:

  • [ ] Write/ modify a test case to check GPU utilization
  • [ ] adapt miniconda/tox-conda in the github action yml
  • [ ] Make sure that github actions/ tests run fine even without available GPUs

Since github actions and tox/tox-conda are rather new tools for me, I would like to ask for additional opinions on this before I invest more time in this. Currently, I see the benefits of (local) GPU testing, but I might have missed a point. What is your opinion?

Eric

erjel avatar Dec 05 '21 20:12 erjel

Codecov Report

Merging #395 (9ee1fea) into master (45f1a3c) will increase coverage by 0.08%. The diff coverage is 81.81%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #395      +/-   ##
==========================================
+ Coverage   38.89%   38.98%   +0.08%     
==========================================
  Files          20       20              
  Lines        5707     5713       +6     
==========================================
+ Hits         2220     2227       +7     
+ Misses       3487     3486       -1     
Impacted Files Coverage Δ
cellpose/core.py 54.72% <75.00%> (-0.50%) :arrow_down:
cellpose/dynamics.py 56.16% <85.71%> (+0.63%) :arrow_up:
cellpose/transforms.py 72.23% <0.00%> (+1.02%) :arrow_up:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 45f1a3c...9ee1fea. Read the comment docs.

codecov-commenter avatar Dec 05 '21 21:12 codecov-commenter

thanks @erjel indeed this would be very useful! I agree that not having GPU tests is not great, and being able to run them locally is certainly useful enough (doesn't need to be integrated into github actions). is tox-conda necessary for this if it's only for local testing? as a developer can I simply run pytest tests/ the same way as usual?

carsen-stringer avatar Jan 15 '22 20:01 carsen-stringer