Repository: cupy/cupy

Issue:
Add Windows support in cuTENSOR download tool
https://github.com/cupy/cupy/pull/4560#issuecomment-764422155


Discussion:
@leofang is this just a question of installing 7zip on CI or is there more to it than that?
> @leofang is this just a question of installing 7zip on CI or is there more to it than that?

@jakirkham No, it's about how to automate things for users. So for cuDNN, CuPy provides a convenient script so that users can install the wheel from PyPI (which has the cuDNN support built, but does not contain cuDNN itself as the wheel would be oversized) and then run
```
$ python -m cupyx.tools.install_library --library cudnn --cuda 10.0
```
and the script would install cuDNN to CuPy's cache dir so that it can be found and linked at runtime. This works on both Linux and Windows.

For cuTENSOR, the same script works on Linux (done in #4560). But for Windows, this workflow has a problem due to unable to extract `.exe` using only the Python standard library (`shutil.unpack_archive`). This is what https://github.com/cupy/cupy/pull/4560#issuecomment-764422155 is about, and also why [I suggested to package it in a format other than `.exe`](https://github.com/cupy/cupy/pull/4617#issuecomment-777032244). I don't see why cuTENSOR has to be packaged in a different way from cuDNN, which just works out of box.
@leofang we're planing to replace the .exe with .zip to resolve this issue. I'll update this thread once the .zip file is available.
That'd be great, thanks @springer13!
The .zip file should be available for download now. Please let us know if this resolved your problem. Thanks
Fantastic, @springer13! I confirm the link works. We should be able to start from here. Thanks a lot!

Resolving patch:
diff --git a/cupyx/tools/install_library.py b/cupyx/tools/install_library.py
--- a/cupyx/tools/install_library.py
+++ b/cupyx/tools/install_library.py
@@ -86,8 +86,7 @@ def _make_cutensor_url(public_version, filename):
 
 
 def _make_cutensor_record(
-        cuda_version, public_version, filename_linux, filename_windows=''):
-    # TODO(leofang): Support Windows when a public link becomes available
+        cuda_version, public_version, filename_linux, filename_windows):
     return {
         'cuda': cuda_version,
         'cutensor': public_version,
@@ -96,22 +95,30 @@ def _make_cutensor_record(
                 'url': _make_cutensor_url(public_version, filename_linux),
                 'filename': 'libcutensor.so.{}'.format(public_version),
             },
+            'Windows': {
+                'url': _make_cutensor_url(public_version, filename_windows),
+                'filename': 'cutensor.dll',
+            },
         }
     }
 
 
 _cutensor_records.append(_make_cutensor_record(
     '11.1', '1.2.2',
-    'libcutensor-linux-x86_64-1.2.2.5.tar.gz', ''))
+    'libcutensor-linux-x86_64-1.2.2.5.tar.gz',
+    'libcutensor-windows-x86_64-1.2.2.5.zip'))
 _cutensor_records.append(_make_cutensor_record(
     '11.0', '1.2.2',
-    'libcutensor-linux-x86_64-1.2.2.5.tar.gz', ''))
+    'libcutensor-linux-x86_64-1.2.2.5.tar.gz',
+    'libcutensor-windows-x86_64-1.2.2.5.zip'))
 _cutensor_records.append(_make_cutensor_record(
     '10.2', '1.2.2',
-    'libcutensor-linux-x86_64-1.2.2.5.tar.gz', ''))
+    'libcutensor-linux-x86_64-1.2.2.5.tar.gz',
+    'libcutensor-windows-x86_64-1.2.2.5.zip'))
 _cutensor_records.append(_make_cutensor_record(
     '10.1', '1.2.2',
-    'libcutensor-linux-x86_64-1.2.2.5.tar.gz', ''))
+    'libcutensor-linux-x86_64-1.2.2.5.tar.gz',
+    'libcutensor-windows-x86_64-1.2.2.5.zip'))
 library_records['cutensor'] = _cutensor_records
 
 


Test patch: