-
Notifications
You must be signed in to change notification settings - Fork 60
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
Implement Cache and __cuda_array_interface__ for v21.06.00 #48
Implement Cache and __cuda_array_interface__ for v21.06.00 #48
Conversation
Remove scripts/docs related to bump2version because we don't need it anymore since the versioning scheme is changed to CalVer.
e977979
to
c310b6f
Compare
Hi @ajschmidt8, could this change be merged into 21.06.00 branch before the release (#47)? |
python/cucim/setup.py
Outdated
@@ -49,14 +44,13 @@ def read(*names, **kwargs): | |||
url='https://github.com/rapidsai/cucim', | |||
packages=find_packages('src'), | |||
package_dir={'cucim': 'src/cucim'}, | |||
py_modules=[splitext(basename(path))[0] for path in glob('src/*.py')], | |||
# # https://docs.python.org/3/distutils/setupscript.html |
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.
Any reason to leave these comments here instead of removing ?
Same question for the package_data=
commented code below
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.
Oh, no specific reason. Just for future reference. Will remove it. Thank you for pointing out that!
I found it easier to look at the individual commits. I left a few small comments on the |
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 Gigon! 😄
Had some questions below
python/cucim/src/localtest.py
Outdated
# count = 0 | ||
# for h in range(start_location, height, tile_size): | ||
# for w in range(start_location, width, tile_size): | ||
# count += 1 | ||
# start_loc_iter = ((w, h) | ||
# for h in range(start_location, height, tile_size) | ||
# for w in range(start_location, width, tile_size)) | ||
# with Timer(" Thread elapsed time (OpenSlide)") as timer: | ||
# with concurrent.futures.ThreadPoolExecutor( | ||
# max_workers=num_workers | ||
# ) as executor: | ||
# executor.map( | ||
# lambda start_loc: load_tile_openslide( | ||
# slide, start_loc, tile_size), | ||
# start_loc_iter, | ||
# ) | ||
# openslide_time = timer.elapsed_time() | ||
# openslide_tot_time += openslide_time |
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.
Why is this commented?
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.
my bad. changed the code during the local testing. Will revert it. Thanks!
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.
All good. Thanks Gigon! 😄
python/cucim/src/localtest.py
Outdated
# print(" Performance gain (OpenSlide/cuCIM): {}".format( | ||
# openslide_time / cucim_time)) |
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.
Same question here
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.
Will revert it.
@@ -77,13 +79,13 @@ gpuci_conda_retry build -c ${LIBCUCIM_BLD_PATH} -c conda-forge -c rapidsai-night | |||
|
|||
# Install cuCIM and its dependencies | |||
gpuci_logger "Installing cuCIM and its dependencies" | |||
gpuci_conda_retry install -y -c ${LIBCUCIM_BLD_PATH} -c ${CUCIM_BLD_PATH} \ | |||
"rapids-build-env=$MINOR_VERSION.*" \ |
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.
Why did this get dropped?
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.
I found that there is no rapids-build-env package whose version is $MINOR_VERSION.*
as we switched to CalVer.
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.
@gigony, this will need to be re-added. We use the rapidsai-nightly
conda channel for pre-release packaging. You can find the cal-ver packages here: https://anaconda.org/rapidsai-nightly/rapids-build-env/files
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.
Somewhat related. I think we are missing an activate
line (this is probably my fault). Was trying to fix that here ( 495aa73 ). Think we may need to add that as well
cpp/include/cucim/cuimage.h
Outdated
#include "cucim/core/framework.h" | ||
|
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.
nit: Could we drop this blank line?
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! Will remove it.
cpp/src/memory/memory_manager.cu
Outdated
@@ -74,4 +68,53 @@ void get_pointer_attributes(PointerAttributes& attr, const void* ptr) | |||
} | |||
} | |||
|
|||
bool move_raster_from_host(void** target, size_t size, cucim::io::Device& dst_device) |
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.
Can device be const
?
bool move_raster_from_host(void** target, size_t size, cucim::io::Device& dst_device) | |
bool move_raster_from_host(void** target, size_t size, const cucim::io::Device& dst_device) |
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.
Yes, it should be const
. Will update it.
cpp/src/memory/memory_manager.cu
Outdated
return true; | ||
} | ||
|
||
bool move_raster_from_device(void** target, size_t size, cucim::io::Device& dst_device) |
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.
bool move_raster_from_device(void** target, size_t size, cucim::io::Device& dst_device) | |
bool move_raster_from_device(void** target, size_t size, const cucim::io::Device& dst_device) |
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.
Yes, it should be const
. Will update it.
version=read('VERSION').strip(), # versioneer.get_version(), | ||
# cmdclass=versioneer.get_cmdclass() | ||
cmdclass=versioneer.get_cmdclass(), |
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.
If we are using versioneer for cmdclass
, should we use for version
as well?
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.
In case of versioneer, version comes from git tags, but C++ code's build system currently requires version as VERSION
file.
I can try to refactor C++ code builder to get the version from git tags later (https://ipenguin.ws/2012/11/cmake-automatically-use-git-tags-as.html) but the current VERSION file seems okay to me.
Currently, version number from versioneer is used only when CuPy with scikit-image is available (#44, 818dc2f#diff-80a85bd6c52ce89c0dc59a606ca1205a2673c20ff860c65a3964db51ffa64ec8R47)
# Try to import cupy first. | ||
# If cucim.clara package is imported first, you may see the following error when running on CUDA 10.x (#44) | ||
# python3: Relink `/usr/lib/x86_64-linux-gnu/libnccl.so.2.8.3' with `/lib/x86_64-linux-gnu/librt.so.1' for IFUNC symbol `clock_gettime' | ||
# Segmentation fault | ||
try: | ||
import cupy | ||
except ImportError: | ||
pass |
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.
Interesting. Do we know why that is?
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.
Don't know the exact root cause, but I guess,
This change is related to #44
If the system has only CUDA 10.x library, since cucim.clara part of the library depends on CUDA 11 and different version of runtime, it looks that it can conflict with symbols CUDA-based library that depends on CUDA 10.X
You can see version-related issues from other Github issue:
tensorflow/tensorflow#19375
python/cucim/src/localtest.py
Outdated
for num_workers in range(1, num_threads + 1): | ||
for num_workers in (num_threads,): # range(1, num_threads + 1): |
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.
Why is this commented?
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 is modified during the local test (since I didn't want to execute it for all available thread # configurations.)
Reverted it.
Thanks @jakirkham and @quasiben for the review! I would address your comments tonight. |
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.
Few changes requested here. Also, branch-21.06
is in code-freeze, so the base branch for this PR will need to be updated to branch-21.08
.
@@ -77,13 +79,13 @@ gpuci_conda_retry build -c ${LIBCUCIM_BLD_PATH} -c conda-forge -c rapidsai-night | |||
|
|||
# Install cuCIM and its dependencies | |||
gpuci_logger "Installing cuCIM and its dependencies" | |||
gpuci_conda_retry install -y -c ${LIBCUCIM_BLD_PATH} -c ${CUCIM_BLD_PATH} \ | |||
"rapids-build-env=$MINOR_VERSION.*" \ |
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.
@gigony, this will need to be re-added. We use the rapidsai-nightly
conda channel for pre-release packaging. You can find the cal-ver packages here: https://anaconda.org/rapidsai-nightly/rapids-build-env/files
CHANGELOG.md
Outdated
@@ -1,4 +1,4 @@ | |||
# cuCIM 21.06.00 (Date TBD) | |||
# cuCIM [21.06.00](https://github.com/rapidsai/cucim/wiki/release_notes_v21.06.00) (Date TBD) |
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.
For consistency with the changelogs of other RAPIDS libraries, this change should probably be removed. Also, we have a script that updates the changelog during each release, so it would overwrite this change.
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.
Oh, I see. Will remove it from here.
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.
And for the following change, will try to read rapids-build-env with rapidsai-nightly version.
gpuci_conda_retry install -y -c ${LIBCUCIM_BLD_PATH} -c ${CUCIM_BLD_PATH} \
"rapids-build-env=$MINOR_VERSION.*" \
For clarity, we'd like for this to be released with 21.06 as other libraries would like to pick this up -- but not part of the larger RAPIDS integration meta-package. Is that something we could do ? |
@quasiben, gotcha. This PR has a lot of changes, so I'm not sure it'd be a good idea to merge all of this a few days before the release. Couple questions here though.
|
Several of these changes were in previous PRs that were blocked due to CI issues. So Gigon has aggregated them together. IOW they are not as new as they might seem The changes are really limited to cuCIM and are mainly in response to needs Clara has in their downstream libraries or outside user requests. So they shouldn't affect other RAPIDS libraries |
@gigony would be better positioned to answer these questions:
Again, @gigony can you also comment here ? |
1.
MONAI and Clara Train SDK is using cuCIM.
since they are using PyPI package and I would release new version of PyPI
package(21.06.00) separately tomorrow, conda package doesn't affect to
those projects. However, not merging this would cause a discrepancy between
the two packages (conda vs PyPI) and that's what I am worrying about.
2.
I am sorry for the last minute changes. I will try to push all the needed
change before code freeze next time.
…On Mon, Jun 7, 2021 at 11:52 AM Benjamin Zaitlen ***@***.***> wrote:
@gigony <https://github.com/gigony> would be better positioned to answer
these questions:
1. Which libraries require these changes?
a. MONAI is a higher lever product depending on
2. Are the changes here considered "required" for 21.06 to work? Or
are they just "nice-to-haves"?
a. The majority of these changes are in the required for 21.06. I
would hope these large code changes before releases decreases as the
library matures.
Again, @gigony <https://github.com/gigony> can you also comment here ?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#48 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAOW2SW4KQCVIOIWEAUI4PDTRUIOVANCNFSM46ENHSCA>
.
|
I think this is fine to merge this into |
Thanks @raydouglass |
Thank you @quasiben @jakirkham @ajschmidt8 for the review! I have addressed your comments except #48 (comment) to make sure that this change is buildable without errors. Could we merge this PR first and then apply @jakirkham 's patches shown below, to use rapids conda environment? |
`__array_interface__` for the object returned by `CuImage.associated_image()` was missing so cannot be converted numpy. This bug was introduced during the implementation of Cache and support for `__cuda_array_interface__`: #48 . `associated_image()` API is not frequently used by users so it's fine. We will need to add a test case for this once the artificial test image with the associated image (such as Philips TIFF) is available. Authors: - Gigon Bae (https://github.com/gigony) Approvers: - https://github.com/jakirkham URL: #65
I'm sorry for this big change.
This includes CI build failure fixes as well as new features/fixes/documents that couldn't be merged due to CI build failures.
@quasiben on top of your change (#46), the only missing piece was, adding
pytest
(8334f1f) (which was not revealed until I addedset -x
to the build script (fae529d).@jakirkham This change doesn't include a doc builder change in your PR (
https://github.com/rapidsai/cucim/pull/45/files#diff-5ed0e3039eb400d13dc55579a034925ea8d08e9f2054085b1c79fdc46a7c09a8L29) so the script may need to further updated in the next change.
__cuda_array_interface__