Nothing Special   »   [go: up one dir, main page]

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

[WIP] Add cmake build scheme #3068

Draft
wants to merge 97 commits into
base: develop
Choose a base branch
from
Draft

Conversation

SteveBronder
Copy link
Collaborator

Summary

This adds a cmake build system for Stan Math. The main features are

  1. This works with cmakes FetchContent module. So users can call the following to include stan math into their library that also uses cmake
FetchContent_Declare(
  stanmath
  GIT_REPOSITORY https://github.com/stan-dev/math
  GIT_TAG  develop
)

// later for building their executable
target_link_libraries(my_ex stanmath::stanmath)

Importantly, this allows stan and cmdstan etc to do the above which is nice.

  1. tests can all be run with ctest. Currently only batched tests by folder are supported but I'll add individual targets for each test in this PR as well.

It seems like this takes much less time to compile per folder. For example the test/unit/math/mix/fun tests all compile into one object file which took about 12 minutes on my machine using 24 cores (and at max about 65 gb of memory)

time make -j24 test_unit_math_mix_fun && ./test_prob_weibull
real	12m34.919s
user	247m45.300s
sys	7m40.696s

The prob tests also work and are broken down by folder

make -j28 test_prob_weibull && ./test_prob_weibull

I'd like to make targets for all of unit and all of prob to put into jenkins.

The expression tests are not setup yet but I'll have them done before this pr is merged.

A few other things that need to be done / checked before merge

  • Opencl tests
  • mpi tests
  • threading tests

Tests

I'm not sure how to test the cmake files but am open to suggestions

Release notes

Replace this text with a short note on what will change if this pull request is merged in which case this will be included in the release notes.

Checklist

  • Copyright holder: Steve Bronder

    The copyright holder is typically you or your assignee, such as a university or company. By submitting this pull request, the copyright holder is agreeing to the license the submitted work under the following licenses:
    - Code: BSD 3-clause (https://opensource.org/licenses/BSD-3-Clause)
    - Documentation: CC-BY 4.0 (https://creativecommons.org/licenses/by/4.0/)

  • the basic tests are passing

    • unit tests pass (to run, use: ./runTests.py test/unit)
    • header checks pass, (make test-headers)
    • dependencies checks pass, (make test-math-dependencies)
    • docs build, (make doxygen)
    • code passes the built in C++ standards checks (make cpplint)
  • the code is written in idiomatic C++ and changes are documented in the doxygen

  • the new changes are tested

@SteveBronder
Copy link
Collaborator Author

Sorry closing for now, thought opening up a draft would not turn on the tests

@SteveBronder
Copy link
Collaborator Author

Reopening to test some jenkins things. Still not ready for review

@SteveBronder SteveBronder reopened this May 29, 2024
@SteveBronder
Copy link
Collaborator Author

@serban-nicusor-toptal would it be possible to update the cmake version on jenkins to > 3.18?

@serban-nicusor-toptal
Copy link
Contributor

Hey @SteveBronder of course! I will have to rebuild the docker image we use and will reply here with the updated tag. We can use this tag in the PR and if all goes well merge it.
I'll try to do it sometime early tomorrow.

@serban-nicusor-toptal
Copy link
Contributor

Hey @SteveBronder,
I'm pushing a new tag stanorg/ci:gpu-cmake3.30.5, feel free to change it and see how it goes.
As a note, I was talking earlier with @WardBrian , Intel discontinued the Intel OpenCL SDK, they recommend to switch to https://github.com/intel/compute-runtime/releases
We're pretty sure OpenCL on Intel CPU might not be used at all, but worth keeping in mind. I've built this image without it so let's hope everything goes well!
To keep a record of this, I've created a PR in ci-scripts : stan-dev/ci-scripts#36

@SteveBronder
Copy link
Collaborator Author

Thank you!! Taking it for a spin now

@SteveBronder
Copy link
Collaborator Author

I'm pretty sure we only use opencl on the gpu, but if we run into errors we can install their new opencl setup

@SteveBronder
Copy link
Collaborator Author

22h 0m 13s

Killed. I think building one large executable is too much for the jenkins computer. Going to switch this up to build several smaller executables

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants