Skip to content

Conversation

malfet
Copy link
Contributor

@malfet malfet commented Apr 24, 2020

In build-variables.bzl split filelist into libtorch_python_core_sources and libtorch_python_distributed_sources
Move jit passes from glob_libtorch_python_sources() to libtorch_core_jit_sources filelist

Validated that original TORCH_PYTHON_SRCS filelist matches one in build_varaiables.bzl by running the following script:

import os

def read_file(path):
    with open(path) as f:
        return f.read()

def get_cmake_torch_python_srcs():
    caffe2_cmake = read_file("torch/CMakeLists.txt")
    start = caffe2_cmake.find("set(TORCH_PYTHON_SRCS")
    end = caffe2_cmake.find(")", start)
    return caffe2_cmake[start:end+1]

def get_cmake_torch_python_srcs_list():
    _srcs = get_cmake_torch_python_srcs()
    unfiltered_list = [x.strip() for x in _srcs.split("\n") if len(x.strip())>0]
    return [x.replace("${TORCH_SRC_DIR}/","torch/") for x in unfiltered_list if 'TORCH_SRC_DIR' in x]

import imp
build_variables = imp.load_source('build_variables', 'tools/build_variables.bzl')
libtorch_python_sources = set(build_variables.libtorch_python_core_sources)
torch_python_srcs = set(get_cmake_torch_python_srcs_list())

print(set.difference(libtorch_python_sources, torch_python_srcs))

Test Plan: CI

@malfet malfet requested review from dzhulgakov, orionr and suo April 24, 2020 23:48
@dr-ci
Copy link

dr-ci bot commented Apr 24, 2020

💊 Build failures summary and remediations

As of commit 574ef72 (more details on the Dr. CI page):


  • 1/1 failures possibly* introduced in this PR
    • 1/1 non-CircleCI failure(s)

ci.pytorch.org: 1 failed


This comment was automatically generated by Dr. CI (expand for details).Follow this link to opt-out of these comments for your Pull Requests.

Please report bugs/suggestions on the GitHub issue tracker.

See how this bot performed.

This comment has been revised 11 times.

@malfet
Copy link
Contributor Author

malfet commented Apr 25, 2020

pytorch_linux_xenial_cuda10_2_cudnn7_py3_gcc7_build
failure should be fixed by #37275

@malfet malfet force-pushed the malfet/cmake-read-torch-python-from-build-variables branch from fc956ed to 0bd4f8b Compare April 25, 2020 04:40
@malfet
Copy link
Contributor Author

malfet commented Apr 27, 2020

Rebasing, just to make sure everything is still green.

Copy link
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.

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

In build-variables.bzl split filelist into `libtorch_python_core_sources` and `libtorch_python_distributed_sources`
Move jit passes from `glob_libtorch_python_sources()` to `libtorch_core_jit_sources` filelist

Validated that original `TORCH_PYTHON_SRCS` filelist matches one in `build_varaiables.bzl` by running the following script:
```
import os

def read_file(path):
    with open(path) as f:
        return f.read()

def get_cmake_torch_python_srcs():
    caffe2_cmake = read_file("torch/CMakeLists.txt")
    start = caffe2_cmake.find("set(TORCH_PYTHON_SRCS")
    end = caffe2_cmake.find(")", start)
    return caffe2_cmake[start:end+1]

def get_cmake_torch_python_srcs_list():
    _srcs = get_cmake_torch_python_srcs()
    unfiltered_list = [x.strip() for x in _srcs.split("\n") if len(x.strip())>0]
    return [x.replace("${TORCH_SRC_DIR}/","torch/") for x in unfiltered_list if 'TORCH_SRC_DIR' in x]

import imp
build_variables = imp.load_source('build_variables', 'tools/build_variables.bzl')
libtorch_python_sources = set(build_variables.libtorch_python_core_sources)
torch_python_srcs = set(get_cmake_torch_python_srcs_list())

print(set.difference(libtorch_python_sources, torch_python_srcs))
```

Test Plan: CI
@malfet malfet force-pushed the malfet/cmake-read-torch-python-from-build-variables branch from 0bd4f8b to 574ef72 Compare April 27, 2020 16:47
Copy link
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.

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

@malfet malfet deleted the malfet/cmake-read-torch-python-from-build-variables branch April 27, 2020 23:17
@facebook-github-bot
Copy link
Contributor

@malfet merged this pull request in d294c06.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants