Skip to content

Use the newer one of cmake and cmake3.#12916

Closed
ssnl wants to merge 3 commits intopytorch:masterfrom
ssnl:cmakever
Closed

Use the newer one of cmake and cmake3.#12916
ssnl wants to merge 3 commits intopytorch:masterfrom
ssnl:cmakever

Conversation

@ssnl
Copy link
Copy Markdown
Collaborator

@ssnl ssnl commented Oct 21, 2018

On my devgpu, cmake is newer than cmake3. Using cmake3 causes compilation to fail. Instead of blindly using cmake3, we pick the newer of the two.

@ssnl ssnl requested a review from orionr October 21, 2018 19:14
@soumith
Copy link
Copy Markdown
Collaborator

soumith commented Oct 21, 2018

please revert the large number of whitespace changes

Copy link
Copy Markdown
Contributor

@facebook-github-bot facebook-github-bot left a comment

Choose a reason for hiding this comment

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

SsnL has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

@orionr
Copy link
Copy Markdown
Contributor

orionr commented Oct 21, 2018

Looks good - thanks.

@ssnl ssnl closed this Oct 21, 2018
@ssnl ssnl reopened this Oct 21, 2018
@ssnl
Copy link
Copy Markdown
Collaborator Author

ssnl commented Oct 21, 2018

@pytorchbot retest this please

Copy link
Copy Markdown
Contributor

@facebook-github-bot facebook-github-bot left a comment

Choose a reason for hiding this comment

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

SsnL is landing this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

@zdevito
Copy link
Copy Markdown
Contributor

zdevito commented Oct 22, 2018

This breaks for me on python2:

[zdevito@devgpu172.prn2 /data/users/zdevito/pytorch] doit build develop && python test/test_jit.py
NVCC VERSION nvcc: NVIDIA (R) Cuda compiler driver Copyright (c) 2005-2018 NVIDIA Corporation Built on Wed_Apr_11_23:16:29_CDT_2018 Cuda compilation tools, release 9.2, V9.2.88
GCC=/home/zdevito/local/ccache/bin/gcc
NVCC=/usr/local/cuda/bin/nvcc
CUDA_NVCC_EXECUTABLE=/home/zdevito/local/ccache/cuda/nvcc
Building wheel torch-1.0.0a0+e64f75a
running build
running build_deps
setup.py::build_deps::run()
+ SYNC_COMMAND=cp
++ command -v rsync
+ '[' -x /bin/rsync ']'
+ SYNC_COMMAND='rsync -lptgoD'
+ CMAKE_COMMAND=cmake
++ command -v cmake3
+ [[ -x /bin/cmake3 ]]
++ command -v cmake
+ [[ -x /home/zdevito/local/anaconda2/bin/cmake ]]
++ cmake --version
++ grep 'cmake version'
++ awk '{print $NF}'
+ CMAKE_VERSION=3.11.1
++ cmake3 --version
++ grep 'cmake version'
++ awk '{print $NF}'
+ CMAKE3_VERSION=
++ /home/zdevito/local/anaconda2/bin/python -c 'from distutils.version import StrictVersion; print(1 if StrictVersion("") >= StrictVersion("3.11.1") else 0)'
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/home/zdevito/local/anaconda2/lib/python2.7/distutils/version.py", line 140, in __cmp__
    compare = cmp(self.version, other.version)
AttributeError: StrictVersion instance has no attribute 'version'
+ CMAKE3_IS_NEWER=
Failed to run 'bash ../tools/build_pytorch_libs.sh --use-cuda --use-nnpack nccl caffe2 libshm c10d THD'
total build time: 0:00:00.565524, total build time today: 0:00:03.531141

@zdevito
Copy link
Copy Markdown
Contributor

zdevito commented Oct 22, 2018

This fixes it for me:

diff --git a/tools/build_pytorch_libs.sh b/tools/build_pytorch_libs.sh
index 1c2b728ab..f6f01adb7 100755
--- a/tools/build_pytorch_libs.sh
+++ b/tools/build_pytorch_libs.sh
@@ -22,7 +22,7 @@ if [[ -x "$(command -v cmake3)" ]]; then
     if [[ -x "$(command -v cmake)" ]]; then
         # have both cmake and cmake3, compare versions
         CMAKE_VERSION=$(cmake --version | grep 'cmake version' | awk '{print $NF}')
-        CMAKE3_VERSION=$(cmake3 --version | grep 'cmake version' | awk '{print $NF}')
+        CMAKE3_VERSION=$(cmake3 --version | grep 'cmake3 version' | awk '{print $NF}')
         CMAKE3_IS_NEWER=$($PYTORCH_PYTHON -c "from distutils.version import StrictVersion; print(1 if StrictVersion(\"${CMAKE3_VERSION}\") >= StrictVersion(\"${CMAKE_VERSION}\") else 0)")
     else
         # don't have cmake

@ssnl ssnl deleted the cmakever branch October 24, 2018 18:42
facebook-github-bot pushed a commit that referenced this pull request Oct 24, 2018
Summary:
A tweak to #12916 that only uses cmake3 when cmake isn't good enough. Hopefully fixes the issue zdevito saw.

cc zdevito SsnL
Pull Request resolved: #12972

Differential Revision: D10560674

Pulled By: orionr

fbshipit-source-id: 90c71929630bb8167a3ee2cc6f306eefe5b85445
laurentdupin pushed a commit to laurentdupin/pytorch that referenced this pull request Apr 24, 2026
Summary:
On my devgpu, `cmake` is newer than `cmake3`. Using `cmake3` causes compilation to fail. Instead of blindly using `cmake3`, we pick the newer of the two.
Pull Request resolved: pytorch#12916

Differential Revision: D10481922

Pulled By: SsnL

fbshipit-source-id: 8340136c459e25da9f5fc4f420c7e67cadc28aff
laurentdupin pushed a commit to laurentdupin/pytorch that referenced this pull request Apr 24, 2026
Summary:
A tweak to pytorch#12916 that only uses cmake3 when cmake isn't good enough. Hopefully fixes the issue zdevito saw.

cc zdevito SsnL
Pull Request resolved: pytorch#12972

Differential Revision: D10560674

Pulled By: orionr

fbshipit-source-id: 90c71929630bb8167a3ee2cc6f306eefe5b85445
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants