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

Add initial Python unit/performance tests for TIFF loader module #62

Merged
merged 13 commits into from
Jul 27, 2021

Conversation

gigony
Copy link
Contributor

@gigony gigony commented Jun 18, 2021

The main change is for addressing parts of #38 and #61.

  • Add initial unit/perf test cases for TIFF loader
  • Add license texts for python tests

This also has the following minor changes:

  • Fix some typo in the doc.
  • Remove cupy_rc channel in README.md
  • Update name in Github templates
  • Update calculation of patch_down_count

And build/doc related changes

  • Update build script and contributing guide
  • Fix broken links in docs
  • Sort import statements by using isort
./run test                             # execute all tests
./run test python                      # execute all python tests
./run test python unit                 # execute all python unit tests
./run test python unit skimage         # execute all python unit tests in `skimage` module
./run test python unit clara           # execute all python unit tests in `clara` module
./run test python performance          # execute all python performance tests

Current test folder structure looks like below:

python/cucim/tests/
├── __init__.py
├── conftest.py
├── fixtures
│   └── testimage.py
├── integration
│   ├── __init__.py
│   └── clara
│       └── __init__.py
├── performance
│   ├── __init__.py
│   └── clara
│       ├── __init__.py
│       └── test_read_region_memory_usage.py
├── test_cucim.py
├── unit
│   ├── __init__.py
│   └── clara
│       ├── __init__.py
│       ├── test_image_cache.py
│       ├── test_load_image.py
│       ├── test_load_image_metadata.py
│       └── test_tiff_read_region.py
└── util
    ├── gen_image.py
    └── gen_tiff.py

@gigony gigony requested review from a team as code owners June 18, 2021 01:44
@gigony gigony self-assigned this Jun 18, 2021
@gigony gigony added improvement Improves an existing functionality non-breaking Introduces a non-breaking change labels Jun 18, 2021
@gigony gigony force-pushed the python_unittests branch 5 times, most recently from 4d20d78 to 7e972c6 Compare June 18, 2021 18:29
Copy link
Member

@jakirkham jakirkham left a comment

Choose a reason for hiding this comment

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

Thanks Gigon! 😄

Had a couple suggestions about CI changes that I think we can now drop as well as one question

ci/gpu/build.sh Outdated Show resolved Hide resolved
ci/gpu/build.sh Outdated Show resolved Hide resolved
ci/gpu/build.sh Show resolved Hide resolved
CuPy 9 is now default so RC release is not needed.
__PROJECT__ needs to be cuCIM.
When calculating the maximal number of tiles (y-axis)
overlapped with the given patch, patch size souldn't be
larger than the original image size.
Consider the fact during the calculation.
@gigony gigony force-pushed the python_unittests branch 4 times, most recently from aac3f7a to c1dc1c5 Compare June 30, 2021 16:57
Copy link
Member

@ajschmidt8 ajschmidt8 left a comment

Choose a reason for hiding this comment

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

Approving ops-codeowner file changes

@gigony gigony force-pushed the python_unittests branch 3 times, most recently from d8cbbe4 to 5c1f329 Compare July 2, 2021 05:04
OpenSlide's result can be different among environments due to
differences in JPEG dequantization of the JPEG libraries so remove
such logic.
@gigony
Copy link
Contributor Author

gigony commented Jul 2, 2021

@jakirkham now it is building. Could you please help review this?

Copy link
Contributor

@grlee77 grlee77 left a comment

Choose a reason for hiding this comment

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

Hi Gigon, this looks mostly good to me. I left just some minor comments.

The style of passing the image parameters as a string with : separator seems a little un-Pythonic, but this is only for test code, not part of the public API, so I don't have a problem with it.

I have not yet tried running this code, but can try that on the 5th or 6th.

python/cucim/tests/util/gen_image.py Show resolved Hide resolved
python/cucim/tests/unit/clara/test_load_image.py Outdated Show resolved Hide resolved
python/cucim/tests/unit/clara/test_tiff_read_region.py Outdated Show resolved Hide resolved
python/cucim/tests/unit/clara/test_tiff_read_region.py Outdated Show resolved Hide resolved
python/cucim/tests/unit/clara/test_tiff_read_region.py Outdated Show resolved Hide resolved
python/cucim/tests/unit/clara/test_tiff_read_region.py Outdated Show resolved Hide resolved
python/cucim/tests/unit/clara/test_tiff_read_region.py Outdated Show resolved Hide resolved
run Outdated Show resolved Hide resolved
Copy link
Contributor Author

@gigony gigony left a comment

Choose a reason for hiding this comment

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

Thank you @grlee77 for the all valuable review! Please help review the updated code.

python/cucim/tests/util/gen_image.py Show resolved Hide resolved
python/cucim/tests/unit/clara/test_load_image.py Outdated Show resolved Hide resolved
python/cucim/tests/unit/clara/test_tiff_read_region.py Outdated Show resolved Hide resolved
python/cucim/tests/unit/clara/test_tiff_read_region.py Outdated Show resolved Hide resolved
python/cucim/tests/unit/clara/test_tiff_read_region.py Outdated Show resolved Hide resolved
python/cucim/tests/unit/clara/test_tiff_read_region.py Outdated Show resolved Hide resolved
python/cucim/tests/unit/clara/test_tiff_read_region.py Outdated Show resolved Hide resolved
run Outdated Show resolved Hide resolved
Copy link
Contributor

@grlee77 grlee77 left a comment

Choose a reason for hiding this comment

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

Thanks, the test dependency installation looks much cleaner now in the run script.

It would be nice to also update the developer docs to mention how the tests should be run (in CONTRIBUTING.md?)

@gigony gigony added the doc Improvements or additions to documentation label Jul 10, 2021
@gigony
Copy link
Contributor Author

gigony commented Jul 10, 2021

@grlee77 Addressed your comments.
Please help review them.

The following commits are added:

@gigony gigony removed the doc Improvements or additions to documentation label Jul 10, 2021
@gigony gigony force-pushed the python_unittests branch 2 times, most recently from cca3585 to 5148e28 Compare July 10, 2021 07:21
@gigony gigony removed the request for review from quasiben July 12, 2021 22:36
Copy link
Contributor

@grlee77 grlee77 left a comment

Choose a reason for hiding this comment

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

I reviewed the recent commits, making only a few small suggestions

Thank you for adding the clean and clean_cache options to the run script!

python/cucim/ci/bootstrap.py Outdated Show resolved Hide resolved
python/cucim/setup.py Outdated Show resolved Hide resolved
CONTRIBUTING.md Outdated Show resolved Hide resolved
CONTRIBUTING.md Outdated Show resolved Hide resolved
Copy link
Member

@jakirkham jakirkham left a comment

Choose a reason for hiding this comment

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

Thanks Gigon! 😄

This looks pretty good. Also like the addition of the clean command 🙂

Had a couple minor questions about the environment file

@@ -16,8 +16,12 @@ dependencies:
- scipy
- python=3.8
- cudatoolkit=11.0
- cudatoolkit-dev=11.0
Copy link
Member

Choose a reason for hiding this comment

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

Why is this needed?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

In Conda package, cudatoolkit package doesn't include nvcc binary, but nvcc is needed to build the project so added it. Does it make sense? Any other solution to do that? :)

Copy link
Member

Choose a reason for hiding this comment

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

Yeah it doesn't. We are working on a longer term solution ( conda-forge/cudatoolkit-feedstock#62 )

However this package was added for historical reasons to help users run the CUDA installer. I don't think we should be using it

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@jakirkham for now, what would be a good solution until the long-term solution is available?
Currently, without installing cudatoolkit-dev, it would try to find system's nvcc if available which cannot be isolated in the environment. Do you think we can keep the change(cudatoolkit-dev) until the long-term solution is available?

Copy link
Member

Choose a reason for hiding this comment

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

Is it ok if we just rely on the system one for now? Or are there other issues with that?

Should add that others may just be using our prebuilt packages. So think this is more a question of what works for us

Copy link
Contributor Author

@gigony gigony Jul 22, 2021

Choose a reason for hiding this comment

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

Is it ok if we just rely on the system one for now? Or are there other issues with that?

I thought env.yml is for setting up 'development environment' to build cuCIM locally from the source code and it is not for the runtime environment (it already has more than needed for just running cuCIM. e.g., yasm/compilers/cmake/flake8 etc).

I don't think all users (developer who want to contribute here) have the same nvcc version needed (in this case, CUDA 11.0) in the system so I think cudatoolkit-dev with the same version of cudatoolkit is needed.

Maybe we need to separate out env.yml -- one for dev, one for runtime.

conda/environments/env.yml Outdated Show resolved Hide resolved
@gigony
Copy link
Contributor Author

gigony commented Jul 26, 2021

Hi @jakirkham, can this PR be merged or do I need to address others?

@jakirkham
Copy link
Member

@gpucibot merge

@rapids-bot rapids-bot bot merged commit 3afa154 into rapidsai:branch-21.08 Jul 27, 2021
@jakirkham
Copy link
Member

Thanks Gigon! 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
improvement Improves an existing functionality non-breaking Introduces a non-breaking change
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants