Skip to content

Commit

Permalink
Add support for modular build structure. (#1160)
Browse files Browse the repository at this point in the history
* Make the library modular usable.

* Fix -Wundef warnings

* Switch to library requirements instead of source. As source puts extra source in install targets.

* Add missing NO_LIB usage requirements.

* Remove boost-root relative include path.

* Add missing import-search for cconfig/predef checks.

* Add requires-b2 check to top-level build file.

* Sync upstream.

* Fix typo in test framework reference.

* Bump B2 require to 5.2

* Update copyright dates.

* Move inter-lib dependencies to a project variable and into the build targets.

* Switch to /boost/test//included target for header only mode of Boost.Test.

* Adjust doc build to avoid boost-root references.

* Update build deps.

* Fix project props not applying to the no_eh.obj compile.

* Update build deps.

* Add missing import-search.

* Fix float128_type checks to actually disable tests. Problem was that build is a non-free feature. Which can't be acquired through a usage requirement.

* GPU Batch 7

Fix igamma_large support on device

Add GPU support to toms748

Add GPU support to igamma_inv

Add GPU markers to gamma_inva

Add GPU Markers to lgamma_small

Remove STL usage from gamma

Remove NVRTC workaround

Fix fraction use of STL headers

Mark gamma functions in fwd

Disable declval on all GPU platforms

Disable more unneeded code on device

Add forward decl for NVRTC tgamma

Disable unneeded items for all GPU

Change workaround for missing overloads

Rearrange definition location

Add include path to cuda now that workaround is removed

Fix NVRTC incompatibility with recursion and forward decls

Add tgamma_ratio CUDA and NVRTC testing

Fix NVRTC handling of gamma_p_derivative

Add gamma_p_derivative CUDA and NVRTC testing

Remove recursion from gamma_incomplete_imp

Add SYCL testing of igamma, igamma_inv, and igamma_inva

Ignore literal-range warnings

Remove use of static const char* for function name

Fix missing CUDA header

Remove calls under NVRTC to fwd decl

Add more nvrtc workarounds

Use builtin erfc instead of header cycle

Add CUDA and NVRTC testing of gamma_p_inv

Adjust tolerances

Add GPU support to chi squared dist

Fix static local variable

Add chi squared dist SYCL testing

Add chi squared dist CUDA testing

Add chi squared dist NVRTC testing

Add GPU support to weibull dist

Add weibull dist SYCL testing

Add weibull dist CUDA testing

Add weibull dist NVRTC testing

* Fix policy macro definition for MSVC platforms

* Don't add quadmath lib for has_128bit_floatmax_t check. It was accidentally copy+pasted.

* Fix incorrect name for float128 type check that caused it to not apear.

---------

Co-authored-by: Matt Borland <matt@mattborland.com>
  • Loading branch information
grafikrobot and mborland authored Sep 6, 2024
1 parent ab57b20 commit 41f07b0
Show file tree
Hide file tree
Showing 44 changed files with 832 additions and 759 deletions.
48 changes: 48 additions & 0 deletions build.jam
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# Copyright René Ferdinand Rivera Morell 2023-2024
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt or copy at
# http://www.boost.org/LICENSE_1_0.txt)

require-b2 5.2 ;

constant boost_dependencies :
/boost/assert//boost_assert
/boost/concept_check//boost_concept_check
/boost/config//boost_config
/boost/core//boost_core
/boost/integer//boost_integer
/boost/lexical_cast//boost_lexical_cast
/boost/predef//boost_predef
/boost/random//boost_random
/boost/static_assert//boost_static_assert
/boost/throw_exception//boost_throw_exception ;

project /boost/math
: common-requirements
<include>include
;

explicit
[ alias boost_math : : : : <library>$(boost_dependencies) ]
[ alias boost_math_c99 : build//boost_math_c99 ]
[ alias boost_math_c99f : build//boost_math_c99f ]
[ alias boost_math_c99l : build//boost_math_c99l ]
[ alias boost_math_tr1 : build//boost_math_tr1 ]
[ alias boost_math_tr1f : build//boost_math_tr1f ]
[ alias boost_math_tr1l : build//boost_math_tr1l ]
[ alias all :
boost_math
boost_math_c99 boost_math_c99f boost_math_c99l
boost_math_tr1 boost_math_tr1f boost_math_tr1l
example test ]
[ alias testing : : : :
<include>test
<include>include_private ]
;

call-if : boost-library math
: install boost_math
boost_math_c99 boost_math_c99f boost_math_c99l
boost_math_tr1 boost_math_tr1f boost_math_tr1l
;

38 changes: 20 additions & 18 deletions build/Jamfile.v2
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
# copyright John Maddock 2008
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt or copy at
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt or copy at
# http://www.boost.org/LICENSE_1_0.txt.

import testing ;
import pch ;
import ../../config/checks/config : requires ;
import-search /boost/config/checks ;
import config : requires ;

project
: requirements
<toolset>intel-win:<cxxflags>-nologo
<toolset>intel-win:<linkflags>-nologo
project
: common-requirements <library>$(boost_dependencies)
: requirements
<toolset>intel-win:<cxxflags>-nologo
<toolset>intel-win:<linkflags>-nologo
#<toolset>intel-linux:<pch>off
<toolset>intel-darwin:<pch>off
<toolset>gcc,<target-os>windows:<pch>off
Expand All @@ -20,9 +22,11 @@ project
[ check-target-builds ../config//has_gcc_visibility "gcc visibility" : <toolset>gcc:<cxxflags>-fvisibility=hidden : ]
[ requires cxx11_noexcept cxx11_rvalue_references sfinae_expr cxx11_auto_declarations cxx11_lambdas cxx11_unified_initialization_syntax cxx11_hdr_tuple cxx11_hdr_initializer_list cxx11_hdr_chrono cxx11_thread_local cxx11_constexpr cxx11_nullptr cxx11_numeric_limits cxx11_decltype cxx11_hdr_array cxx11_hdr_atomic cxx11_hdr_type_traits cxx11_allocator cxx11_explicit_conversion_operators ]
[ requires cxx14_decltype_auto cxx14_generic_lambdas cxx14_return_type_deduction cxx14_variable_templates cxx14_decltype_auto cxx14_generic_lambdas cxx14_return_type_deduction ]
: usage-requirements
<define>BOOST_MATH_TR1_NO_LIB=1
;

cpp-pch pch : ../src/tr1/pch.hpp : <include>../src/tr1 <link>shared:<define>BOOST_MATH_TR1_DYN_LINK=1 ;
cpp-pch pch : ../src/tr1/pch.hpp : <include>../src/tr1 <link>shared:<define>BOOST_MATH_TR1_DYN_LINK=1 ;

C99_SOURCES = acosh
asinh
Expand All @@ -46,7 +50,7 @@ round
tgamma
trunc ;

TR1_SOURCES =
TR1_SOURCES =
assoc_laguerre
assoc_legendre
beta
Expand Down Expand Up @@ -80,46 +84,44 @@ import targets ;

obj long_double_check : ../config/has_long_double_support.cpp ;
explicit long_double_check ;

# Library targets
lib boost_math_tr1 : ../src/tr1/$(TR1_SOURCES).cpp pch
:
:
<link>shared:<define>BOOST_MATH_TR1_DYN_LINK=1
<include>../src/tr1
;

lib boost_math_tr1f : ../src/tr1/$(TR1_SOURCES)f.cpp pch
:
:
<link>shared:<define>BOOST_MATH_TR1_DYN_LINK=1
<include>../src/tr1
;

lib boost_math_tr1l : ../src/tr1/$(TR1_SOURCES)l.cpp pch
:
:
<link>shared:<define>BOOST_MATH_TR1_DYN_LINK=1
<dependency>../config//has_long_double_support
<include>../src/tr1
[ check-target-builds ../config//has_long_double_support "long double support" : : <build>no ]
;

lib boost_math_c99 : ../src/tr1/$(C99_SOURCES).cpp pch
:
:
<link>shared:<define>BOOST_MATH_TR1_DYN_LINK=1
<include>../src/tr1
;

lib boost_math_c99f : ../src/tr1/$(C99_SOURCES)f.cpp pch
:
:
<link>shared:<define>BOOST_MATH_TR1_DYN_LINK=1
<include>../src/tr1
;

lib boost_math_c99l : ../src/tr1/$(C99_SOURCES)l.cpp pch
:
:
<link>shared:<define>BOOST_MATH_TR1_DYN_LINK=1
<dependency>../config//has_long_double_support
<include>../src/tr1
[ check-target-builds ../config//has_long_double_support "long double support" : : <build>no ]
;

boost-install boost_math_c99 boost_math_c99f boost_math_c99l boost_math_tr1 boost_math_tr1f boost_math_tr1l ;
10 changes: 5 additions & 5 deletions config/Jamfile.v2
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ import path ;
local ntl-path = [ modules.peek : NTL_PATH ] ;
local gmp_path = [ modules.peek : GMP_PATH ] ;

lib quadmath ;
lib fftw3 ;
lib fftw3f ;
lib fftw3l ;
lib fftw3q ;
searched-lib quadmath ;
searched-lib fftw3 ;
searched-lib fftw3f ;
searched-lib fftw3l ;
searched-lib fftw3q ;

obj has_long_double_support : has_long_double_support.cpp ;
obj has_mpfr_class : has_mpfr_class.cpp :
Expand Down
14 changes: 7 additions & 7 deletions doc/Jamfile.v2
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ path-constant here : . ;
constant here-url : [ regex.replace $(here) "\\\\" "/" ] ;

xml math : math.qbk :
<quickbook-define>enable_index
<quickbook-define>enable_index
<quickbook-define>__base_path__=$(here-url)
<format>pdf:<quickbook-define>__build_pdf
<format>html:<quickbook-define>__build_html
Expand All @@ -25,7 +25,7 @@ boostbook standalone
# Path for links to Boost:
<xsl:param>boost.root=../../../..
<xsl:param>html.stylesheet=math.css

# Some general style settings:
<xsl:param>table.footnote.number.format=1
<xsl:param>footnote.number.format=1
Expand All @@ -46,11 +46,11 @@ boostbook standalone
# Index on type:
<xsl:param>index.on.type=1
<xsl:param>boost.noexpand.chapter.toc=1

#<xsl:param>root.filename="sf_dist_and_tools"
#<xsl:param>graphicsize.extension=1
#<xsl:param>use.extensions=1

# PDF Options:
# TOC Generation: this is needed for FOP-0.9 and later:
<xsl:param>fop1.extensions=0
Expand All @@ -74,23 +74,23 @@ boostbook standalone
# better use SVG's instead:
<format>pdf:<xsl:param>admon.graphics.extension=".svg"
<format>pdf:<xsl:param>admon.graphics.path=$(here)/../../../doc/src/images/
<format>pdf:<xsl:param>use.role.for.mediaobject=1
<format>pdf:<xsl:param>use.role.for.mediaobject=1
<format>pdf:<xsl:param>preferred.mediaobject.role=print
<format>pdf:<xsl:param>img.src.path=$(images_location)/
<format>pdf:<xsl:param>draft.mode="no"
<format>pdf:<xsl:param>boost.url.prefix=http\://www.boost.org/doc/libs/release/libs/math/doc/html
<auto-index>on <format>pdf:<auto-index-internal>off
<format>html:<auto-index-internal>on
<auto-index-script>$(here)/index.idx
<auto-index-prefix>$(here)/../../..
<auto-index-prefix>$(here)/../include
#<auto-index-verbose>on
<format>pdf:<xsl:param>index.on.type=1
;

install pdfinstall : standalone/<format>pdf : <location>. <install-type>PDF <name>math.pdf ;
explicit pdfinstall ; # b2 pdf pdfinstall to do this pdf file copy.

install css_install : math.css : <location>$(here)/html ;
install css_install : math.css : <location>$(here)/html ;

###############################################################################
alias boostdoc ;
Expand Down
14 changes: 8 additions & 6 deletions example/Jamfile.v2
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,13 @@

# bring in the rules for testing
import testing ;
import ../../config/checks/config : requires ;
import-search /boost/config/checks ;
import config : requires ;

project
: requirements
<library>/boost/math//boost_math
<library>/boost/multiprecision//boost_multiprecision
<toolset>gcc:<cxxflags>-Wno-missing-braces
<toolset>darwin:<cxxflags>-Wno-missing-braces
<toolset>acc:<cxxflags>+W2068,2461,2236,4070
Expand All @@ -36,7 +39,6 @@ project
<toolset>clang:<cxxflags>-Wno-unknown-pragmas
<toolset>clang:<cxxflags>-Wno-language-extension-token

<include>../../..
<include>../include_private
<exception-handling>off:<source>../test//no_eh
[ requires cxx11_noexcept cxx11_rvalue_references sfinae_expr cxx11_auto_declarations cxx11_lambdas cxx11_unified_initialization_syntax cxx11_hdr_tuple cxx11_hdr_initializer_list cxx11_hdr_chrono cxx11_thread_local cxx11_constexpr cxx11_nullptr cxx11_numeric_limits cxx11_decltype cxx11_hdr_array cxx11_hdr_atomic cxx11_hdr_type_traits cxx11_allocator cxx11_explicit_conversion_operators ]
Expand All @@ -53,7 +55,7 @@ test-suite examples :
[ run binomial_example_nag.cpp ]
[ run binomial_quiz_example.cpp : : : <exception-handling>off:<build>no ]
[ run binomial_sample_sizes.cpp ]
[ run brent_minimise_example.cpp : : : [ requires cxx11_hdr_tuple ] ]
[ run brent_minimise_example.cpp /boost/test//included : : : [ requires cxx11_hdr_tuple ] ]

[ run c_error_policy_example.cpp ]
[ run chi_square_std_dev_test.cpp : : : <exception-handling>off:<build>no ]
Expand Down Expand Up @@ -93,11 +95,11 @@ test-suite examples :

[ run nonfinite_num_facet.cpp ]
[ run nonfinite_facet_simple.cpp ]
#[ run nonfinite_num_facet_serialization.cpp ../../serialization/build//boost_serialization : : : <exception-handling>off:<build>no <toolset>gcc-mingw:<link>static ]
#[ run nonfinite_num_facet_serialization.cpp /boost/serialization//boost_serialization : : : <exception-handling>off:<build>no <toolset>gcc-mingw:<link>static ]
#[ # run lexical_cast_native.cpp ] # Expected to fail on some (but not all) platforms.
[ run lexical_cast_nonfinite_facets.cpp ]
[ run nonfinite_loopback_ok.cpp ]
#[ run nonfinite_serialization_archives.cpp ../../serialization/build//boost_serialization : : : <exception-handling>off:<build>no <toolset>gcc-mingw:<link>static ]
#[ run nonfinite_serialization_archives.cpp /boost/serialization//boost_serialization : : : <exception-handling>off:<build>no <toolset>gcc-mingw:<link>static ]
[ run nonfinite_facet_sstream.cpp ]

[ run constants_eg1.cpp ]
Expand All @@ -113,7 +115,7 @@ test-suite examples :
[ run policy_eg_6.cpp ]
[ run policy_eg_7.cpp ]
[ run policy_eg_8.cpp ]
[ run policy_eg_9.cpp ]
[ run policy_eg_9.cpp /boost/format//boost_format ]
[ run policy_ref_snip1.cpp : : : <exception-handling>off:<build>no ]
[ run policy_ref_snip10.cpp ]
[ run policy_ref_snip11.cpp ]
Expand Down
Loading

0 comments on commit 41f07b0

Please sign in to comment.