Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Building with CMake #498

Merged
merged 1 commit into from Dec 13, 2021

Conversation

sogartar
Copy link

This is a WIP of the CMake building.

This PR supersede #478.

Currently the building of the compiler_gym directory is done.
Building of tests, benchmarks, examples and the python package itself lies ahead.
There is a bit of cleanup and renaming to do after that. Some of the functionality form the auto-conversion from Bazel to CMake may prove to be unnecessary.

I plan not to use CMake's ctest functionality for tests, since it is not a part of the building itself. I will make the tests and benchmarks proper build targets.

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Nov 30, 2021
@sogartar
Copy link
Author

I would like to have the CI run for this PR.

@ChrisCummins
Copy link
Contributor

Looking good @sogartar! I'll have a more detailed pick through the changes and run the instructions from the updated README when I find time, probably towards the end of this week. :-)

I would like to have the CI run for this PR.

Done!

Cheers,
Chris

@codecov-commenter
Copy link

codecov-commenter commented Dec 1, 2021

Codecov Report

Merging #498 (5e3516e) into development (187c470) will decrease coverage by 0.29%.
The diff coverage is 100.00%.

Impacted file tree graph

@@               Coverage Diff               @@
##           development     #498      +/-   ##
===============================================
- Coverage        87.37%   87.08%   -0.30%     
===============================================
  Files              113      113              
  Lines             6401     6403       +2     
===============================================
- Hits              5593     5576      -17     
- Misses             808      827      +19     
Impacted Files Coverage Δ
compiler_gym/envs/llvm/__init__.py 100.00% <100.00%> (ø)
compiler_gym/envs/compiler_env.py 87.32% <0.00%> (-2.16%) ⬇️
...loop_tool/service/loop_tool_compilation_session.py 86.57% <0.00%> (-2.02%) ⬇️
compiler_gym/service/connection.py 75.67% <0.00%> (-1.36%) ⬇️
compiler_gym/datasets/dataset.py 85.60% <0.00%> (-0.81%) ⬇️
compiler_gym/envs/llvm/datasets/cbench.py 76.69% <0.00%> (-0.76%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 187c470...5e3516e. Read the comment docs.

@ChrisCummins
Copy link
Contributor

Ah, I just noticed that this is marked WIP. I'll hold back on taking a look until you request a review 🙂

Cheers,
Chris

@sogartar
Copy link
Author

sogartar commented Dec 3, 2021

@ChrisCummins, will it be possible to have the CI run automatically when I update the PR branch?

@ChrisCummins
Copy link
Contributor

Hmm that's strange, normally I only have to approve the CI running once per new contributor - looks like it disabled itself somehow! :-) The CI should be active again now, and will automatically re-run every time you push to the branch.

Cheers,
Chris

@sogartar
Copy link
Author

sogartar commented Dec 3, 2021

@ChrisCummins, I may be considered a first time contributor, because my contribution technically has not been approved yet.

@ChrisCummins
Copy link
Contributor

Ah, that must be it! I don't have access to the settings page to change that behavior, so if you would like to file a meaningless one line PR then I can merge that to give you contributor status :)

Cheers,
Chris

@sogartar
Copy link
Author

sogartar commented Dec 3, 2021

@ChrisCummins, here is my empty PR #499.

@sogartar
Copy link
Author

sogartar commented Dec 4, 2021

@ChrisCummins, I think the PR is in a good shape for a review.
The majority of tests pass. What is left is the benchmarks, examples and the generation of the python package.
I think I can do them in another PR, as this one is already big.

@sogartar sogartar changed the title [WIP] Add Building with CMake Add Building with CMake Dec 4, 2021
@ChrisCummins
Copy link
Contributor

Great thanks @sogartar, I will take a look tomorrow! Yep, I'm happy to split things over multiple PRs to make reviewing easier.

Cheers,
Chris

Copy link
Contributor

@ChrisCummins ChrisCummins left a comment

Choose a reason for hiding this comment

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

Hi @sogartar, I have a few other commitments ATM so it may take me a couple of passes to go through all of this PR, but I thought it'd be worth sharing my notes so far.

I followed along with your new INSTALL.md steps on this machine:

$ cat /etc/os-release
NAME="Pop!_OS"
VERSION="20.10"
ID=pop
ID_LIKE="ubuntu debian"
PRETTY_NAME="Pop!_OS 20.10"
VERSION_ID="20.10"
HOME_URL="https://pop.system76.com"
SUPPORT_URL="https://support.system76.com"
BUG_REPORT_URL="https://github.com/pop-os/pop/issues"
PRIVACY_POLICY_URL="https://system76.com/privacy"
VERSION_CODENAME=groovy
UBUNTU_CODENAME=groovy
LOGO=distributor-logo-pop-os

I was able to get as far as running the actual build, when I hit an error that I'm not sure how to work around:

$ cmake  --build "$BUILD_DIR"
[1532/1767] Generating csmith
FAILED: compiler_gym/third_party/csmith/csmith 
cd /home/cec/src/CompilerGym/cmake_build/compiler_gym/third_party/csmith && /home/cec/.local/bin/cmake -E create_symlink /home/cec/src/CompilerGym/cmake_build/compiler_gym/third_party/csmith/csmith/bin/csmith /home/cec/src/CompilerGym/cmake_build/compiler_gym/third_party/csmith/csmith
failed to create symbolic link '/home/cec/src/CompilerGym/cmake_build/compiler_gym/third_party/csmith/csmith' because existing path cannot be removed: Is a directory
[1557/1767] Building C object _deps/grpc-build/th...akeFiles/crypto.dir/src/crypto/fipsmodule/bcm.c.o
ninja: build stopped: subcommand failed.
cmake --build "$BUILD_DIR"  1023.32s user 116.98s system 1955% cpu 58.314 total

Also, it looks like the cmake build on the CI took 4.5hrs, is this to be expected?

CleanShot 2021-12-07 at 15 16 56@2x

On my machine, the initial cmake invocation took 31 min, then about 1 minute of actual build before I hit the error posted above.

I left some other notes inline :) Hope they're helpful!

Cheers,
Chris

CMakeLists.txt Show resolved Hide resolved
Comment on lines +179 to +131
-DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache \ # For faster rebuilds, can be removed
-DCMAKE_EXE_LINKER_FLAGS_INIT="-fuse-ld=lld" -DCMAKE_MODULE_LINKER_FLAGS_INIT="-fuse-ld=lld" -DCMAKE_SHARED_LINKER_FLAGS_INIT="-fuse-ld=lld" \ # For faster builds, can be removed
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
-DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache \ # For faster rebuilds, can be removed
-DCMAKE_EXE_LINKER_FLAGS_INIT="-fuse-ld=lld" -DCMAKE_MODULE_LINKER_FLAGS_INIT="-fuse-ld=lld" -DCMAKE_SHARED_LINKER_FLAGS_INIT="-fuse-ld=lld" \ # For faster builds, can be removed
-DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
-DCMAKE_EXE_LINKER_FLAGS_INIT="-fuse-ld=lld" -DCMAKE_MODULE_LINKER_FLAGS_INIT="-fuse-ld=lld" -DCMAKE_SHARED_LINKER_FLAGS_INIT="-fuse-ld=lld" \

On my shell (zsh 5.8), anything after the escaping \ is invalid and causes a syntax error:

$ cmake -GNinja \
  -DCMAKE_C_COMPILER=clang-9 \
  -DCMAKE_CXX_COMPILER=clang++-9 \
  -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
  -DCMAKE_EXE_LINKER_FLAGS_INIT="-fuse-ld=lld"-DCMAKE_MODULE_LINKER_FLAGS_INIT="-fuse-ld=lld" -DCMAKE_SHARED_LINKER_FLAGS_INIT="-fuse-ld=lld" \
  -DPython3_FIND_VIRTUALENV=FIRST \
  -S "$SOURCE_DIR" \
  -B "$BUILD_DIR"
zsh: no matches found:  #
zsh: no matches found:  #
zsh: command not found: -DPython3_FIND_VIRTUALENV=FIRST

Copy link
Author

Choose a reason for hiding this comment

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

I reorganized the instructions and this problem is not present there.

Copy link
Contributor

Choose a reason for hiding this comment

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

Looks like this optional arguments are still in the base command though. Tbh I think it would be fine to simply update the lld to lld-9 and then include them as part of the base command, since the lld-9 package is part of the required dependencies.

Copy link
Author

Choose a reason for hiding this comment

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

I updated to use lld-9 explicitly. I think on your system, lld-9 is not the default lld.

INSTALL.md Outdated
Comment on lines 98 to 101
wget -O - https://apt.kitware.com/keys/kitware-archive-latest.asc 2>/dev/null | gpg --dearmor - | sudo tee /etc/apt/trusted.gpg.d/kitware.gpg >/dev/null
sudo apt-add-repository "deb https://apt.kitware.com/ubuntu/ $(lsb_release -cs) main"
sudo apt update
sudo apt install kitware-archive-keyring
sudo rm /etc/apt/trusted.gpg.d/kitware.gpg
sudo apt update
sudo apt install cmake=3.20\* cmake-data=3.20\*
```
Copy link
Contributor

Choose a reason for hiding this comment

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

This didn't work for me:

$ sudo apt-add-repository -y "deb https://apt.kitware.com/ubuntu/ $(lsb_release -cs) main"

Repository: 'deb https://apt.kitware.com/ubuntu/ groovy main'
Description:
Archive for codename: groovy components: main
More info: https://apt.kitware.com/ubuntu/
Adding repository.
Adding deb entry to /etc/apt/sources.list.d/archive_uri-https_apt_kitware_com_ubuntu_-groovy.list
Adding disabled deb-src entry to /etc/apt/sources.list.d/archive_uri-https_apt_kitware_com_ubuntu_-groovy.list
Hit:1 http://ppa.launchpad.net/jgmath2000/et/ubuntu groovy InRelease
Get:2 https://download.docker.com/linux/ubuntu groovy InRelease [43.3 kB]                           
Hit:3 http://ppa.launchpad.net/system76/pop/ubuntu groovy InRelease                                 
Hit:4 http://dl.google.com/linux/chrome/deb stable InRelease                                        
Hit:5 http://us.archive.ubuntu.com/ubuntu groovy InRelease                                          
Hit:6 http://us.archive.ubuntu.com/ubuntu groovy-security InRelease                                 
Hit:7 http://apt.pop-os.org/proprietary groovy InRelease                                            
Hit:8 http://us.archive.ubuntu.com/ubuntu groovy-updates InRelease                                  
Hit:9 https://download.sublimetext.com apt/stable/ InRelease                                 
Hit:10 http://us.archive.ubuntu.com/ubuntu groovy-backports InRelease  
Ign:11 https://apt.kitware.com/ubuntu groovy InRelease
Err:12 https://apt.kitware.com/ubuntu groovy Release
  404  Not Found [IP: 66.194.253.25 443]
Reading package lists... Done
E: The repository 'https://apt.kitware.com/ubuntu groovy Release' does not have a Release file.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.

Rather than installing through the package manager, how about using a specific binary? This is what I do for hadolint/bazel on Linux. Something like:

wget https://github.com/Kitware/CMake/releases/download/v3.20.5/cmake-3.20.5-linux-x86_64.sh -O cmake.sh
bash cmake.sh --prefix=$HOME/.local --exclude-subdir --skip-license
rm cmake.sh

That will install to ~/.local/bin/cmake.

Copy link
Contributor

Choose a reason for hiding this comment

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

I also had to remove the -fuse-ld flags on my machine:

$ ~/.local/bin/cmake -GNinja -DCMAKE_C_COMPILER=clang-9 -DCMAKE_CXX_COMPILER=clang++-9 -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_EXE_LINKER_FLAGS_INIT="-fuse-ld=lld"-DCMAKE_MODULE_LINKER_FLAGS_INIT="-fuse-ld=lld" -DCMAKE_SHARED_LINKER_FLAGS_INIT="-fuse-ld=lld" -DPython3_FIND_VIRTUALENV=FIRST -S "$SOURCE_DIR" -B "$BUILD_DIR"

-- Check for working C compiler: /bin/clang-9 - broken
CMake Error at /home/cec/.local/share/cmake-3.20/Modules/CMakeTestCCompiler.cmake:66 (message):
  The C compiler

    "/bin/clang-9"

  is not able to compile a simple test program.

  It fails with the following output:

    Change Dir: /home/cec/src/CompilerGym/cmake_build/CMakeFiles/CMakeTmp
    
    Run Build Command(s):/bin/ninja cmTC_0c2f4 && [1/2] Building C object CMakeFiles/cmTC_0c2f4.dir/testCCompiler.c.o
    [2/2] Linking C executable cmTC_0c2f4
    FAILED: cmTC_0c2f4 
    : && /bin/clang-9  -fuse-ld=lld-DCMAKE_MODULE_LINKER_FLAGS_INIT=-fuse-ld=lld CMakeFiles/cmTC_0c2f4.dir/testCCompiler.c.o -o cmTC_0c2f4   && :
    clang: error: invalid linker name in argument '-fuse-ld=lld-DCMAKE_MODULE_LINKER_FLAGS_INIT=-fuse-ld=lld'
    ninja: build stopped: subcommand failed.

Diff between the command that failed and the command that worked:

- $ ~/.local/bin/cmake -GNinja -DCMAKE_C_COMPILER=clang-9 -DCMAKE_CXX_COMPILER=clang++-9 -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_EXE_LINKER_FLAGS_INIT="-fuse-ld=lld"-DCMAKE_MODULE_LINKER_FLAGS_INIT="-fuse-ld=lld" -DCMAKE_SHARED_LINKER_FLAGS_INIT="-fuse-ld=lld" -DPython3_FIND_VIRTUALENV=FIRST -S "$SOURCE_DIR" -B "$BUILD_DIR"
+ $ ~/.local/bin/cmake -GNinja -DCMAKE_C_COMPILER=clang-9 -DCMAKE_CXX_COMPILER=clang++-9 -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DPython3_FIND_VIRTUALENV=FIRST -S "$SOURCE_DIR" -B "$BUILD_DIR"

Copy link
Author

Choose a reason for hiding this comment

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

Did you install the lld-9 package? It is part of one of the steps. Supposedly, lld is a faster linker? I wanted to use it to speed up the build. Some parts of LLVM take a long time to link.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yep I have lld-9, although on my system it only installs the versioned binary, so maybe the problem is its looking for an unversioned lld binary?

$ which lld-9
/bin/lld-9
                                                                                                                                                   
$ which lld  
lld not found

Copy link
Contributor

Choose a reason for hiding this comment

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

Just to confirm, using lld-9 worked for me:

~/.local/bin/cmake -GNinja -DCMAKE_C_COMPILER=clang-9 -DCMAKE_CXX_COMPILER=clang++-9 -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_EXE_LINKER_FLAGS_INIT="-fuse-ld=lld-9" -DCMAKE_MODULE_LINKER_FLAGS_INIT="-fuse-ld=lld-9" -DCMAKE_SHARED_LINKER_FLAGS_INIT="-fuse-ld=lld-9" -DPython3_FIND_VIRTUALENV=FIRST -S "$SOURCE_DIR" -B "$BUILD_DIR"

INSTALL.md Outdated
### Dependency instructions for Ubuntu

#### CMake
Requires CMake (==3.20).
Copy link
Contributor

Choose a reason for hiding this comment

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

Does it have to be this specific version? Could be relaxed to older/newer versions? The conda version of cmake lags behind at 3.19, but would make for a much easier install (conda install -c anaconda cmake)

Copy link
Author

Choose a reason for hiding this comment

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

I used some 3.20 stuff and I had problems with a later version when downloading the external dependencies.

INSTALL.md Outdated Show resolved Hide resolved
INSTALL.md Outdated Show resolved Hide resolved
DO NOT SUBMIT Outdated Show resolved Hide resolved
@@ -0,0 +1,48 @@
#[=======================================================================[.rst:
Copy link
Contributor

Choose a reason for hiding this comment

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

For this file (and all other *.cmake files), is it your own code? If so it needs the CompilerGym license header. If it's taken from another project, does it need a license header + attribution for that project?

Copy link
Author

Choose a reason for hiding this comment

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

Some parts of the code come from IREE's Bazel to CMake autoconversion tool. That is under Apache 2.0 license and it needs attribution.

Copy link
Contributor

Choose a reason for hiding this comment

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

Okay, in that case I think that the *.cmake files should have IREE's license header added

@sogartar
Copy link
Author

sogartar commented Dec 7, 2021

$ cmake  --build "$BUILD_DIR"
[1532/1767] Generating csmith
FAILED: compiler_gym/third_party/csmith/csmith 
cd /home/cec/src/CompilerGym/cmake_build/compiler_gym/third_party/csmith && /home/cec/.local/bin/cmake -E create_symlink /home/cec/src/CompilerGym/cmake_build/compiler_gym/third_party/csmith/csmith/bin/csmith /home/cec/src/CompilerGym/cmake_build/compiler_gym/third_party/csmith/csmith
failed to create symbolic link '/home/cec/src/CompilerGym/cmake_build/compiler_gym/third_party/csmith/csmith' because existing path cannot be removed: Is a  @directory
[1557/1767] Building C object _deps/grpc-build/th...akeFiles/crypto.dir/src/crypto/fipsmodule/bcm.c.o
ninja: build stopped: subcommand failed.
cmake --build "$BUILD_DIR"  1023.32s user 116.98s system 1955% cpu 58.314 total

I think that is caused because the source directory and the binary directory are the same. I put an error message for that.
https://github.com/sogartar/CompilerGym/blob/ee4b37121d9f58eb2ce66533423bf76417d41895/CMakeLists.txt#L3 I don't know why it did not trigger? Did you take the latest changes from the PR?

Also, it looks like the cmake build on the CI took 4.5hrs, is this to be expected?

CleanShot 2021-12-07 at 15 16 56@2x

On my machine, the initial cmake invocation took 31 min, then about 1 minute of actual build before I hit the error posted above.

This is a super build that builds most dependencies with Compiler Gym. The configuration step takes so long because many of the dependencies are built then. They need to be found after being built, which is a part of the configuration and not the build. CMake's find_package works during configuration.
I think ultimately to speed up this the CI would need to use a snapshot of the prebuilt dependencies an start from there. Another option is to throw more hardware at it.

@sogartar
Copy link
Author

sogartar commented Dec 8, 2021

Also, it looks like the cmake build on the CI took 4.5hrs, is this to be expected?

It turned out that I did not specify ninja as generator in the CI script, so make was used by default and by default it runs one job at a time. I fixed it, it should be faster now.

@ChrisCummins
Copy link
Contributor

Hi @sogartar, thanks for quickly addressing those comments!

I think that is caused because the source directory and the binary directory are the same.

I had the build directory as a subdir of the source directory. Not sure if that matters. Either way, I have pulled your latest changes and am re-running the cmake commands, will let you know how I get on :)

Cheers,
Chris

@ChrisCummins
Copy link
Contributor

I initially hit an error with a missing python module:

$ cmake --build "$BUILD_DIR"                    
[954/1134] Generating compiler_gym_service_pb2_grpc.py
FAILED: compiler_gym/service/proto/compiler_gym_service_pb2_grpc.py 
cd /home/cec/src/CompilerGymCmakeBuild/compiler_gym/service/proto && /home/cec/.local/bin/cmake -E make_directory /home/cec/src/CompilerGymCmakeBuild/compiler_gym/service/proto && /home/cec/anaconda3/envs/compiler_gym/bin/python3.8 -m grpc_tools.protoc --proto_path /home/cec/src/CompilerGym --descriptor_set_in /home/cec/src/CompilerGymCmakeBuild/compiler_gym/service/proto/compiler_gym_service.proto.bin --grpc_python_out /home/cec/src/CompilerGymCmakeBuild compiler_gym/service/proto/compiler_gym_service.proto
/home/cec/anaconda3/envs/compiler_gym/bin/python3.8: Error while finding module specification for 'grpc_tools.protoc' (ModuleNotFoundError: No module named 'grpc_tools')
[979/1134] Linking CXX static library _deps/grpc-build/libgrpc++_unsecure.a
ninja: build stopped: subcommand failed.

After installing it using:

$ python -m pip install grpcio-tools

I was able to complete the build! Nice :)

Cheers,
Chris

@sogartar
Copy link
Author

sogartar commented Dec 8, 2021

grpcio-tools

@sogartar sogartar closed this Dec 8, 2021
@sogartar sogartar reopened this Dec 8, 2021
@sogartar
Copy link
Author

sogartar commented Dec 8, 2021

After installing it using:

$ python -m pip install grpcio-tools

This is included in the compiler_gym/requirements.txt. But the package is grpcio_tools. Note the underscore. But I think they point to the same package.

https://github.com/sogartar/CompilerGym/blob/4caa8675102970892d0b6dd843091b305e36683c/compiler_gym/requirements.txt#L6

@ChrisCummins
Copy link
Contributor

Hi @sogartar,

This is included in the compiler_gym/requirements.txt.

Ah sorry, I missed that you had changed requirements.txt. I might split it into a separate file since it is a build-only dependency and compiler_gym/requirements.txt is used to specify runtime dependencies of the pip package, but this isn't urgent / merge blocking.

It looks like the build is nearly ready to land :-)

The only failure I see is the CI/test-linux-cmake job, perhaps this could be removed from this PR and submitted in a follow-up?

I will take a look through the rest of the PR today.

Cheers,
Chris

Comment on lines 57 to 62
- name: Persist the cmake build
uses: actions/cache@v2
id: cmake_build_cache
with:
path: ~/cmake_build
key: cmake_build-${{ runner.os }}-${{ github.sha }}
Copy link
Contributor

Choose a reason for hiding this comment

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

Nice! Are there any times when this build directory needs to be cleaned? I don't know much about cmake but I recall sometimes having to rm the build directory after changing the build config

Copy link
Author

Choose a reason for hiding this comment

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

I reorganized the CI jobs and removed the cache, because I could not make it be shared between jobs. Now the building and testing are part of the same job. It may be due to the fact that the build dir is huge. On my system when building in release with debug info it is 70+ GiB.

Copy link
Contributor

Choose a reason for hiding this comment

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

Sounds good to me. I use the artifact action to share the built wheels between the various test jobs, but I guess a 70+ GB artifact wouldn't work :)

INSTALL.md Outdated Show resolved Hide resolved
INSTALL.md Outdated Show resolved Hide resolved
@ChrisCummins
Copy link
Contributor

I went through the rest of the PR and left another bunch of comments. Those, along with fixing/disabling the CI test job, and I think it'll be ready to land :) Great work @sogartar!

Cheers,
Chris

@sogartar
Copy link
Author

I went through the rest of the PR and left another bunch of comments. Those, along with fixing/disabling the CI test job, and I think it'll be ready to land :) Great work @sogartar!

Cheers, Chris

I addressed your comments. Let me know if it looks good, so I can squash and rebase before merging.

@ChrisCummins
Copy link
Contributor

Hi @sogartar, thanks for addressing all those comments. LGTM! Please squash and rebase and I'll get it merged :)

Cheers,
Chris

@sogartar
Copy link
Author

sogartar commented Dec 10, 2021

@ChrisCummins I rebased onto the development branch.
It seems the prootobuf version has changed.
In WORKSPACE rules_proto has been advanced and this version uses now protobuf 3.17.0.
https://github.com/bazelbuild/rules_proto/blob/fcad4680fee127dbd8344e6a961a28eef5820ef4/proto/private/dependencies.bzl#L25.
I updated the CMake build accordingly and when building I encountered this error:

https://github.com/facebookresearch/CompilerGym/runs/4486563513?check_suite_focus=true#step:5:27193

It looks like that ProGraML uses an older version of protobuf, namely 3.13.0.
https://github.com/bazelbuild/rules_proto/blob/7e4afce6fe62dbff0a4a03450143146f9f2d7488/proto/private/dependencies.bzl#L25

It includes the generated protobuf header in its interface. I don't know if it is intentional. If it is intentional the protobuf versions in Compiler Gym and ProGraML must match.

I don't know why this problem does not appear in Bazel. Does it somehow resolve to using only one version of the proto family of functions and by extension the same protobuf version?

Co-authored-by: kyle <kyle@nod-labs.com>
@sogartar
Copy link
Author

I reverted the version of protobuf in CMake. It is now different from that in Bazel. It should be advanced at a later stage.

@ChrisCummins
Copy link
Contributor

Hi @sogartar, many thanks for the detailed description of the problem, and I agree with your decision to pin the version of protobuf in CMake to match ProGraML.

I don't know why this problem does not appear in Bazel. Does it somehow resolve to using only one version of the proto family of functions and by extension the same protobuf version?

I'm afraid I don't know either, but I suspect you're right. I think when we declare the dependency in the CompilerGym WORKSPACE here:

https://github.com/facebookresearch/CompilerGym/blob/development/WORKSPACE#L103-L111

that then makes all references to the @rules_proto// package (including those in third party dependencies) resolve to this point.

At some point I'll update the ProGraML dependency to match the version of proto used in CompilerGym.

Cheers,
Chris

Copy link
Contributor

@ChrisCummins ChrisCummins left a comment

Choose a reason for hiding this comment

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

LGTM, ready to merge.

Cheers,
Chris

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.
Projects
CompilerGym roadmap
Done (not yet shipped)
Development

Successfully merging this pull request may close these issues.

None yet

4 participants