Fix windows msbuild bug (#18748)
authorvaeksare <42353187+vaeksare@users.noreply.github.com>
Tue, 2 Apr 2019 21:25:28 +0000 (14:25 -0700)
committerFacebook Github Bot <facebook-github-bot@users.noreply.github.com>
Tue, 2 Apr 2019 21:35:40 +0000 (14:35 -0700)
Summary:
Fix the bug introduced by #18681 where an undefined variable was being used to limit max cpu count when building for Windows without Ninja.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/18748

Differential Revision: D14733209

Pulled By: soumith

fbshipit-source-id: 52fc0dd4dde99da75a6956b63f02da2e647eed4f

tools/build_pytorch_libs.py

index aa0ed89..9bcc405 100644 (file)
@@ -265,6 +265,7 @@ def build_caffe2(version,
             check_call(['cmake', '--build', '.', '--target', 'install', '--config', build_type, '--', '-j', str(j)],
                        cwd=build_dir, env=my_env)
         else:
+            j = max_jobs or str(multiprocessing.cpu_count())
             check_call(['msbuild', 'INSTALL.vcxproj', '/p:Configuration={} /maxcpucount:{}'.format(build_type, j)],
                        cwd=build_dir, env=my_env)
     else: