From 2ee59288e8b6d5b13f011bbabf82e5d4aeaa9a3e Mon Sep 17 00:00:00 2001 From: David Gardner Date: Thu, 10 Oct 2024 15:17:38 -0700 Subject: [PATCH 1/4] Apply fix for cupy issue 8654 from PR 8655 --- recipe/fixes_8654.diff | 122 +++++++++++++++++++++++++++++++++++++++++ recipe/meta.yaml | 4 ++ 2 files changed, 126 insertions(+) create mode 100644 recipe/fixes_8654.diff diff --git a/recipe/fixes_8654.diff b/recipe/fixes_8654.diff new file mode 100644 index 00000000..a5a08423 --- /dev/null +++ b/recipe/fixes_8654.diff @@ -0,0 +1,122 @@ +From 57456d4c07e8b34bb8f92ddea932d763fa1118f1 Mon Sep 17 00:00:00 2001 +From: David Gardner +Date: Wed, 9 Oct 2024 15:45:46 -0700 +Subject: [PATCH 1/5] Fallback to calling platform.machine() if + platform.processor() returns an empty string + +--- + cupy/_environment.py | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/cupy/_environment.py b/cupy/_environment.py +index 4edcf41d3d5..1b3de5c98b9 100644 +--- a/cupy/_environment.py ++++ b/cupy/_environment.py +@@ -470,6 +470,8 @@ def _get_include_dir_from_conda_or_wheel(major: int, minor: int) -> List[str]: + if config is not None and config['packaging'] == 'conda': + if sys.platform.startswith('linux'): + arch = platform.processor() ++ if arch == '': # Not all systems report this ++ arch = platform.machine() + if arch == "aarch64": + arch = "sbsa" + target_dir = f"{arch}-linux" + +From 9dd8f257126b4174a7b4feb39cce529b733e5ed2 Mon Sep 17 00:00:00 2001 +From: David Gardner +Date: Wed, 9 Oct 2024 15:49:57 -0700 +Subject: [PATCH 2/5] Lint fix + +--- + cupy/_environment.py | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/cupy/_environment.py b/cupy/_environment.py +index 1b3de5c98b9..ebaaab10ab4 100644 +--- a/cupy/_environment.py ++++ b/cupy/_environment.py +@@ -470,7 +470,7 @@ def _get_include_dir_from_conda_or_wheel(major: int, minor: int) -> List[str]: + if config is not None and config['packaging'] == 'conda': + if sys.platform.startswith('linux'): + arch = platform.processor() +- if arch == '': # Not all systems report this ++ if arch == '': # Not all systems report this + arch = platform.machine() + if arch == "aarch64": + arch = "sbsa" + +From fc18cbde04a08eda80f5e4b15e2f7bfc5257fc48 Mon Sep 17 00:00:00 2001 +From: David Gardner <96306125+dagardner-nv@users.noreply.github.com> +Date: Wed, 9 Oct 2024 16:08:59 -0700 +Subject: [PATCH 3/5] Update cupy/_environment.py + +Just use `platform.machine()` instead of calling `platform.processor()` and then checking the output + +Co-authored-by: jakirkham +--- + cupy/_environment.py | 4 +--- + 1 file changed, 1 insertion(+), 3 deletions(-) + +diff --git a/cupy/_environment.py b/cupy/_environment.py +index ebaaab10ab4..0916674d11f 100644 +--- a/cupy/_environment.py ++++ b/cupy/_environment.py +@@ -469,9 +469,7 @@ def _get_include_dir_from_conda_or_wheel(major: int, minor: int) -> List[str]: + config = get_preload_config() + if config is not None and config['packaging'] == 'conda': + if sys.platform.startswith('linux'): +- arch = platform.processor() +- if arch == '': # Not all systems report this +- arch = platform.machine() ++ arch = platform.machine() + if arch == "aarch64": + arch = "sbsa" + target_dir = f"{arch}-linux" + +From c59205997de635e46e3a32ce62ac2cbb4cf10547 Mon Sep 17 00:00:00 2001 +From: David Gardner <96306125+dagardner-nv@users.noreply.github.com> +Date: Wed, 9 Oct 2024 16:10:19 -0700 +Subject: [PATCH 4/5] Update cupy/_environment.py + +Assert arch is not empty + +Co-authored-by: jakirkham +--- + cupy/_environment.py | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/cupy/_environment.py b/cupy/_environment.py +index 0916674d11f..3d487e2d323 100644 +--- a/cupy/_environment.py ++++ b/cupy/_environment.py +@@ -472,6 +472,7 @@ def _get_include_dir_from_conda_or_wheel(major: int, minor: int) -> List[str]: + arch = platform.machine() + if arch == "aarch64": + arch = "sbsa" ++ assert arch + target_dir = f"{arch}-linux" + return [ + os.path.join(sys.prefix, "targets", target_dir, "include"), + +From d2ebdf866121b6802d910cbb346965eaf42e4e05 Mon Sep 17 00:00:00 2001 +From: David Gardner +Date: Wed, 9 Oct 2024 16:11:22 -0700 +Subject: [PATCH 5/5] Add an error message to the assert + +--- + cupy/_environment.py | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/cupy/_environment.py b/cupy/_environment.py +index 3d487e2d323..105f16b5d09 100644 +--- a/cupy/_environment.py ++++ b/cupy/_environment.py +@@ -472,7 +472,7 @@ def _get_include_dir_from_conda_or_wheel(major: int, minor: int) -> List[str]: + arch = platform.machine() + if arch == "aarch64": + arch = "sbsa" +- assert arch ++ assert arch, "platform.machine() returned an empty string" + target_dir = f"{arch}-linux" + return [ + os.path.join(sys.prefix, "targets", target_dir, "include"), diff --git a/recipe/meta.yaml b/recipe/meta.yaml index 06754c90..d9d3571e 100644 --- a/recipe/meta.yaml +++ b/recipe/meta.yaml @@ -27,6 +27,10 @@ package: source: - url: https://pypi.io/packages/source/{{ name[0] }}/{{ name }}/{{ name }}-{{ version }}.tar.gz sha256: {{ sha256 }} + patches: + # Apply fix for platform.processor() returning unexpected results on some platforms + # https://github.com/cupy/cupy/issues/8654 + - fixes_8654.patch build: number: {{ number }} From 43d3ee36a2c6b7e5f460ceae8954192236f06269 Mon Sep 17 00:00:00 2001 From: David Gardner Date: Thu, 10 Oct 2024 15:19:29 -0700 Subject: [PATCH 2/4] Bump the build number --- recipe/meta.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipe/meta.yaml b/recipe/meta.yaml index d9d3571e..a710d2d8 100644 --- a/recipe/meta.yaml +++ b/recipe/meta.yaml @@ -1,7 +1,7 @@ {% set name = "cupy" %} {% set version = "13.3.0" %} {% set sha256 = "9a2a17af2b99cce91dd1366939c3805e3f51f9de5046df64f29ccbad3bdf78ed" %} -{% set number = 0 %} +{% set number = 1 %} {% set target_name = "x86_64-linux" %} # [linux64] {% set target_name = "ppc64le-linux" %} # [ppc64le] From 3fc88fb114b100d1dbe6ecf72f39d6c8fb708901 Mon Sep 17 00:00:00 2001 From: David Gardner Date: Thu, 10 Oct 2024 15:35:04 -0700 Subject: [PATCH 3/4] Fix mis-named file --- recipe/meta.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipe/meta.yaml b/recipe/meta.yaml index a710d2d8..ecbd86d2 100644 --- a/recipe/meta.yaml +++ b/recipe/meta.yaml @@ -30,7 +30,7 @@ source: patches: # Apply fix for platform.processor() returning unexpected results on some platforms # https://github.com/cupy/cupy/issues/8654 - - fixes_8654.patch + - fixes_8654.diff build: number: {{ number }} From 3fd77581176218e2e1633ca1a1611d61dff4558e Mon Sep 17 00:00:00 2001 From: David Gardner Date: Thu, 10 Oct 2024 15:54:27 -0700 Subject: [PATCH 4/4] fix diff file --- recipe/fixes_8654.diff | 118 +++++------------------------------------ 1 file changed, 13 insertions(+), 105 deletions(-) diff --git a/recipe/fixes_8654.diff b/recipe/fixes_8654.diff index a5a08423..ceea1275 100644 --- a/recipe/fixes_8654.diff +++ b/recipe/fixes_8654.diff @@ -1,122 +1,30 @@ -From 57456d4c07e8b34bb8f92ddea932d763fa1118f1 Mon Sep 17 00:00:00 2001 -From: David Gardner -Date: Wed, 9 Oct 2024 15:45:46 -0700 -Subject: [PATCH 1/5] Fallback to calling platform.machine() if - platform.processor() returns an empty string +From d31c7fbd3dab8f34f4e0f2d8df88e60ba93d4827 Mon Sep 17 00:00:00 2001 +From: Kenichi Maehashi <939877+kmaehashi@users.noreply.github.com> +Date: Thu, 10 Oct 2024 11:22:05 +0200 +Subject: [PATCH] Merge pull request #8655 from + dagardner-nv/platform-processor-empty-fallback +Switch to using platform.machine() instead of platform.processor() --- - cupy/_environment.py | 2 ++ - 1 file changed, 2 insertions(+) + cupy/_environment.py | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cupy/_environment.py b/cupy/_environment.py -index 4edcf41d3d5..1b3de5c98b9 100644 +index f0df50e0d..039f66e22 100644 --- a/cupy/_environment.py +++ b/cupy/_environment.py -@@ -470,6 +470,8 @@ def _get_include_dir_from_conda_or_wheel(major: int, minor: int) -> List[str]: - if config is not None and config['packaging'] == 'conda': - if sys.platform.startswith('linux'): - arch = platform.processor() -+ if arch == '': # Not all systems report this -+ arch = platform.machine() - if arch == "aarch64": - arch = "sbsa" - target_dir = f"{arch}-linux" - -From 9dd8f257126b4174a7b4feb39cce529b733e5ed2 Mon Sep 17 00:00:00 2001 -From: David Gardner -Date: Wed, 9 Oct 2024 15:49:57 -0700 -Subject: [PATCH 2/5] Lint fix - ---- - cupy/_environment.py | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/cupy/_environment.py b/cupy/_environment.py -index 1b3de5c98b9..ebaaab10ab4 100644 ---- a/cupy/_environment.py -+++ b/cupy/_environment.py -@@ -470,7 +470,7 @@ def _get_include_dir_from_conda_or_wheel(major: int, minor: int) -> List[str]: - if config is not None and config['packaging'] == 'conda': - if sys.platform.startswith('linux'): - arch = platform.processor() -- if arch == '': # Not all systems report this -+ if arch == '': # Not all systems report this - arch = platform.machine() - if arch == "aarch64": - arch = "sbsa" - -From fc18cbde04a08eda80f5e4b15e2f7bfc5257fc48 Mon Sep 17 00:00:00 2001 -From: David Gardner <96306125+dagardner-nv@users.noreply.github.com> -Date: Wed, 9 Oct 2024 16:08:59 -0700 -Subject: [PATCH 3/5] Update cupy/_environment.py - -Just use `platform.machine()` instead of calling `platform.processor()` and then checking the output - -Co-authored-by: jakirkham ---- - cupy/_environment.py | 4 +--- - 1 file changed, 1 insertion(+), 3 deletions(-) - -diff --git a/cupy/_environment.py b/cupy/_environment.py -index ebaaab10ab4..0916674d11f 100644 ---- a/cupy/_environment.py -+++ b/cupy/_environment.py -@@ -469,9 +469,7 @@ def _get_include_dir_from_conda_or_wheel(major: int, minor: int) -> List[str]: +@@ -461,9 +461,10 @@ def _get_include_dir_from_conda_or_wheel(major: int, minor: int) -> List[str]: config = get_preload_config() if config is not None and config['packaging'] == 'conda': if sys.platform.startswith('linux'): - arch = platform.processor() -- if arch == '': # Not all systems report this -- arch = platform.machine() + arch = platform.machine() if arch == "aarch64": arch = "sbsa" - target_dir = f"{arch}-linux" - -From c59205997de635e46e3a32ce62ac2cbb4cf10547 Mon Sep 17 00:00:00 2001 -From: David Gardner <96306125+dagardner-nv@users.noreply.github.com> -Date: Wed, 9 Oct 2024 16:10:19 -0700 -Subject: [PATCH 4/5] Update cupy/_environment.py - -Assert arch is not empty - -Co-authored-by: jakirkham ---- - cupy/_environment.py | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/cupy/_environment.py b/cupy/_environment.py -index 0916674d11f..3d487e2d323 100644 ---- a/cupy/_environment.py -+++ b/cupy/_environment.py -@@ -472,6 +472,7 @@ def _get_include_dir_from_conda_or_wheel(major: int, minor: int) -> List[str]: - arch = platform.machine() - if arch == "aarch64": - arch = "sbsa" -+ assert arch - target_dir = f"{arch}-linux" - return [ - os.path.join(sys.prefix, "targets", target_dir, "include"), - -From d2ebdf866121b6802d910cbb346965eaf42e4e05 Mon Sep 17 00:00:00 2001 -From: David Gardner -Date: Wed, 9 Oct 2024 16:11:22 -0700 -Subject: [PATCH 5/5] Add an error message to the assert - ---- - cupy/_environment.py | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/cupy/_environment.py b/cupy/_environment.py -index 3d487e2d323..105f16b5d09 100644 ---- a/cupy/_environment.py -+++ b/cupy/_environment.py -@@ -472,7 +472,7 @@ def _get_include_dir_from_conda_or_wheel(major: int, minor: int) -> List[str]: - arch = platform.machine() - if arch == "aarch64": - arch = "sbsa" -- assert arch + assert arch, "platform.machine() returned an empty string" target_dir = f"{arch}-linux" return [ os.path.join(sys.prefix, "targets", target_dir, "include"), +-- +2.39.2 +