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

CMake jit_preprocess_files function only runs when needed #7872

Conversation

robertmaynard
Copy link
Contributor

@robertmaynard robertmaynard commented Apr 6, 2021

This correct a couple of issues with the jit_preprocess_files function.

  1. It now always makes sure that the output directory that the jit headers are going into will exist before executing. So if a user deletes <build_dir>/include everything will work as expected
  2. The output of the jitify tool are files that end in .jit.hpp not .jit. This is required to allow generators to build the minimal incremental compilation graph
  3. Mark the input source files as a dependency so when that file is modified, the build-system knows to recompile the jit file.

@robertmaynard robertmaynard requested a review from a team as a code owner April 6, 2021 15:03
@github-actions github-actions bot added CMake CMake build issue libcudf Affects libcudf (C++/CUDA) code. labels Apr 6, 2021
@cwharris
Copy link
Contributor

cwharris commented Apr 6, 2021

Since ARG_OUTPUT is used as both the explicit OUTPUT and to build a list of dependencies, this change doesn't effect the dependency tree, because custom commands are run every build, yes?

@ttnghia
Copy link
Contributor

ttnghia commented Apr 6, 2021

I applied this PR but that still does not help---I still get the same error:

cpp/src/binaryop/binaryop.cpp:23:10: fatal error: jit_preprocessed_files/binaryop/jit/kernel.cu.jit.hpp: No such file or directory
   23 | #include <jit_preprocessed_files/binaryop/jit/kernel.cu.jit.hpp>
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.

@robertmaynard
Copy link
Contributor Author

I applied this PR but that still does not help---I still get the same error:

cpp/src/binaryop/binaryop.cpp:23:10: fatal error: jit_preprocessed_files/binaryop/jit/kernel.cu.jit.hpp: No such file or directory
   23 | #include <jit_preprocessed_files/binaryop/jit/kernel.cu.jit.hpp>
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.

If you run make jitify_preprocess_run ( or ninja jitify_preprocess_run ) do you see that the file <build_dir>/include/ jit_preprocessed_files/binaryop/jit/kernel.cu.jit.hpp exists?

@ttnghia
Copy link
Contributor

ttnghia commented Apr 6, 2021

I just check that. The folder include/jit_preprocessed_files is empty---there is not any subfolder. Nothing there.

@ttnghia
Copy link
Contributor

ttnghia commented Apr 6, 2021

FYI, I tested this PR by deleting everything and checked out the latest branch-0.20, then applied this PR and did a fresh build.

@robertmaynard
Copy link
Contributor Author

Since ARG_OUTPUT is used as both the explicit OUTPUT and to build a list of dependencies, this change doesn't effect the dependency tree, because custom commands are run every build, yes?

Hmmm. I think you are correct as is they will be recompiled each time. But we can fix that to only re-compile when the input file is modified.

@robertmaynard
Copy link
Contributor Author

robertmaynard commented Apr 6, 2021

I can reproduce this behavior on Ubuntu 20.04 with the Makefile Generator but ninja Generator correctly generated files.

@ttnghia
Copy link
Contributor

ttnghia commented Apr 6, 2021

I can reproduce this behavior on Ubuntu 20.04 with the Makefile Generator but ninja generator correctly generated.

Sorry that I mistakenly modified your post---I intentionally wanted to reply-quote instead. My head is a bit fuzzy in the meantime.

My system is exactly like that: Ubuntu 20.04 with the Makefile Generator.

PS: It is funny that github allows users to modify non-authored posts. (oh, that is funny [I promise not to edit any more of your posts] - @cwharris)

@robertmaynard robertmaynard changed the title jit_preprocess_files properly specifies the correct output paths CMake jit_preprocess_files function only runs when needed Apr 6, 2021
@ttnghia
Copy link
Contributor

ttnghia commented Apr 6, 2021

Your new commits fix the issue. Yeah.

@robertmaynard
Copy link
Contributor Author

@cwharris

This now fixes the issue where builds with the Unix Makefiles generator not creating the output directory. It also fixes a couple of issues allowing for better incremental builds. Now CMake will only re-run the JIT step when the input files change. Previously it always was running the JIT step as the output files listed in OUTPUT didn't exist ( either bad names or due to the above generator problem ).

@cwharris
Copy link
Contributor

cwharris commented Apr 6, 2021

Thanks @robertmaynard !

I didn't see this locally because ninja was generating the files whereas cmake does not.

@cwharris cwharris added the 3 - Ready for Review Ready for review by team label Apr 6, 2021
@jlowe jlowe added bug Something isn't working non-breaking Non-breaking change labels Apr 6, 2021
@kkraus14 kkraus14 removed the 3 - Ready for Review Ready for review by team label Apr 6, 2021
@kkraus14 kkraus14 added the 5 - Ready to Merge Testing and reviews complete, ready to merge label Apr 6, 2021
@kkraus14
Copy link
Collaborator

kkraus14 commented Apr 6, 2021

@gpucibot merge

@kkraus14
Copy link
Collaborator

kkraus14 commented Apr 6, 2021

rerun tests

@ttnghia
Copy link
Contributor

ttnghia commented Apr 6, 2021

Rerun tests.

@kkraus14
Copy link
Collaborator

kkraus14 commented Apr 7, 2021

FYI -- ops team is building a new rapids-build-env package that has updated conda packages. The previous package was built at a perfect timing in between the new fsspec and gcsfs versions being released that left things in a broken state.

@kkraus14
Copy link
Collaborator

kkraus14 commented Apr 7, 2021

rerun tests

@codecov
Copy link

codecov bot commented Apr 7, 2021

Codecov Report

Merging #7872 (3ebe3da) into branch-0.19 (7871e7a) will increase coverage by 0.88%.
The diff coverage is n/a.

❗ Current head 3ebe3da differs from pull request most recent head 1d416df. Consider uploading reports for the commit 1d416df to get more accurate results
Impacted file tree graph

@@               Coverage Diff               @@
##           branch-0.19    #7872      +/-   ##
===============================================
+ Coverage        81.86%   82.74%   +0.88%     
===============================================
  Files              101      103       +2     
  Lines            16884    17701     +817     
===============================================
+ Hits             13822    14647     +825     
+ Misses            3062     3054       -8     
Impacted Files Coverage Δ
python/cudf/cudf/utils/dtypes.py 83.44% <0.00%> (-6.08%) ⬇️
python/cudf/cudf/core/column/lists.py 87.41% <0.00%> (-3.99%) ⬇️
python/cudf/cudf/core/column/decimal.py 92.92% <0.00%> (-1.95%) ⬇️
python/cudf/cudf/core/groupby/groupby.py 92.41% <0.00%> (-1.04%) ⬇️
python/cudf/cudf/utils/utils.py 85.36% <0.00%> (-0.07%) ⬇️
python/dask_cudf/dask_cudf/backends.py 89.58% <0.00%> (-0.05%) ⬇️
python/cudf/cudf/__init__.py 100.00% <0.00%> (ø)
python/cudf/cudf/io/feather.py 100.00% <0.00%> (ø)
python/cudf/cudf/core/__init__.py 100.00% <0.00%> (ø)
python/cudf/cudf/utils/ioutils.py 78.71% <0.00%> (ø)
... and 48 more

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 c8c00f1...1d416df. Read the comment docs.

@kkraus14
Copy link
Collaborator

kkraus14 commented Apr 7, 2021

@gpucibot merge

@rapids-bot rapids-bot bot merged commit 5f84ea8 into rapidsai:branch-0.19 Apr 7, 2021
@robertmaynard robertmaynard deleted the fix/jit_preprocess_files_dependency_tracking branch April 7, 2021 12:53
shwina pushed a commit to shwina/cudf that referenced this pull request Apr 7, 2021
)

This correct a couple of issues with the `jit_preprocess_files` function.

1. It now always makes sure that the output directory that the jit headers are going into will exist before executing. So if a user deletes `<build_dir>/include` everything will work as expected
2. The output of the jitify tool are files that end in `.jit.hpp` not `.jit`. This is required to allow generators to build the minimal incremental compilation graph
3. Mark the input source files as a dependency so when that file is modified, the build-system knows to recompile the jit file.

Authors:
  - Robert Maynard (https://github.com/robertmaynard)

Approvers:
  - Christopher Harris (https://github.com/cwharris)
  - Nghia Truong (https://github.com/ttnghia)
  - Jason Lowe (https://github.com/jlowe)
  - Keith Kraus (https://github.com/kkraus14)

URL: rapidsai#7872
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
5 - Ready to Merge Testing and reviews complete, ready to merge bug Something isn't working CMake CMake build issue libcudf Affects libcudf (C++/CUDA) code. non-breaking Non-breaking change
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants