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

Gpu batch 10 test #21

Merged
merged 68 commits into from
Sep 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
68 commits
Select commit Hold shift + click to select a range
21a11d7
Add GPU support to normal dist
mborland Sep 4, 2024
e0914c7
Add SYCL testing of normal dist
mborland Sep 4, 2024
edf64b8
Add CUDA testing of normal dist
mborland Sep 4, 2024
255b3f0
Add NVRTC testing of normal dist
mborland Sep 4, 2024
6157217
NVRTC fixes
mborland Sep 4, 2024
db90741
Move headers for NVRTC support
mborland Sep 4, 2024
a5e2869
Add GPU support to inverse gaussian dist
mborland Sep 4, 2024
a6f6d4a
Add NVRTC testing of inverse Gaussian dist
mborland Sep 4, 2024
e1604ec
Add CUDA testing of inverse gaussian dist
mborland Sep 4, 2024
a7218ff
Add SYCL testing of inverse gaussian dist
mborland Sep 4, 2024
cb2f8b5
Add GPU support to lognormal dist
mborland Sep 4, 2024
bf63418
Add SYCL testing of lognormal dist
mborland Sep 4, 2024
e54dea3
Add CUDA testing of lognormal dist
mborland Sep 4, 2024
3b2f6b4
Add nvrtc testing of lognormal dist
mborland Sep 4, 2024
0672fb8
Add GPU support to negative binomial dist
mborland Sep 4, 2024
05a6201
Avoid float_prior on GPU platform
mborland Sep 4, 2024
c20b734
Add NVRTC testing of negative binomial dist
mborland Sep 4, 2024
d9fbf08
Fix ambiguous use of nextafter
mborland Sep 4, 2024
90e186d
Add CUDA testing of negative binomial dist
mborland Sep 4, 2024
9a3f95b
Fix float_prior workaround
mborland Sep 4, 2024
133544a
Add SYCL testing of negative binomial dist
mborland Sep 4, 2024
47bcf0d
Add GPU support to non_central_beta dist
mborland Sep 4, 2024
f19c543
Add SYCL testing of nc beta dist
mborland Sep 4, 2024
fc59efa
Add CUDA testing of nc beta dist
mborland Sep 4, 2024
9a6786f
Enable generic dist handling on GPU
mborland Sep 4, 2024
a7e2eab
Add GPU support to brent_find_minima
mborland Sep 4, 2024
7b9f8b9
Add NVRTC testing of nc beta dist
mborland Sep 4, 2024
5331b7f
Add utility header
mborland Sep 4, 2024
95ade8a
Replace non-functional macro with new function
mborland Sep 4, 2024
81e13a1
Add GPU support to non central chi squared dist
mborland Sep 5, 2024
6edc17a
Add SYCL testing of non central chi squared dist
mborland Sep 5, 2024
da9f888
Add missing macro definition
mborland Sep 5, 2024
deccd99
Markup generic quantile finder
mborland Sep 5, 2024
da5f2f1
Add CUDA testing of non central chi squared dist
mborland Sep 5, 2024
06e2ecd
Add NVRTC testing of non central chi squared dist
mborland Sep 5, 2024
e6666f8
Add GPU support to the non-central f dist
mborland Sep 5, 2024
d34057a
Add SYCL testing of ncf
mborland Sep 5, 2024
1aec960
Add CUDA testing of ncf dist
mborland Sep 5, 2024
bb66b65
Add NVRTC testing of ncf dist
mborland Sep 5, 2024
4449983
Add GPU support to students_t dist
mborland Sep 5, 2024
4f246c1
Add SYCL testing of students_t dist
mborland Sep 5, 2024
ba6b85e
Add CUDA testing of students_t
mborland Sep 5, 2024
b7fe92b
Add NVRTC testing of students_t dist
mborland Sep 5, 2024
26f5e04
Workaround for header cycle
mborland Sep 5, 2024
a0b3662
Add GPU support to pareto dist
mborland Sep 5, 2024
a9dcbc1
Add SYCL testing of pareto dist
mborland Sep 5, 2024
d684aeb
Add CUDA testing of pareto dist
mborland Sep 5, 2024
c8819b7
Add NVRTC testing of pareto dist
mborland Sep 5, 2024
87fc43a
Add missing header
mborland Sep 5, 2024
35a58be
Add GPU support to poisson dist
mborland Sep 5, 2024
675a0d2
Add SYCL testing of poisson dist
mborland Sep 5, 2024
a44c18d
Add CUDA testing of poisson dist
mborland Sep 5, 2024
49ac32b
Add NVRTC testing of poisson dist
mborland Sep 5, 2024
2c4099d
Add forward decl for NVRTC platform
mborland Sep 5, 2024
1093aff
Add GPU support to rayleigh dist
mborland Sep 6, 2024
ff4da45
Add CUDA testing of rayleigh dist
mborland Sep 6, 2024
d893f56
Add SYCL testing of rayleigh dist
mborland Sep 6, 2024
f1a4ebf
Add NVRTC testing of rayleigh dist
mborland Sep 6, 2024
ddaa552
Add GPU support to triangular dist
mborland Sep 6, 2024
9f815c9
Add SYCL testing of triangular dist
mborland Sep 6, 2024
01c8784
Add NVRTC testing of triangular dist
mborland Sep 6, 2024
628b201
Add CUDA testing of triangular dist
mborland Sep 6, 2024
91c760d
Add GPU support to the uniform dist
mborland Sep 6, 2024
939082e
Add CUDA testing of uniform dist
mborland Sep 6, 2024
1a2f9e1
Add SYCL testing of uniform dist
mborland Sep 6, 2024
1f6fa9c
Add NVRTC testing of uniform dist
mborland Sep 6, 2024
d88d9e4
Fix missing header
mborland Sep 6, 2024
e3000c7
Add markers to docs
mborland Sep 6, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 9 additions & 7 deletions doc/distributions/inverse_gaussian.qbk
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@
typedef RealType value_type;
typedef Policy policy_type;

inverse_gaussian_distribution(RealType mean = 1, RealType scale = 1);
BOOST_MATH_GPU_ENABLED inverse_gaussian_distribution(RealType mean = 1, RealType scale = 1);

RealType mean()const; // mean default 1.
RealType scale()const; // Optional scale, default 1 (unscaled).
RealType shape()const; // Shape = scale/mean.
BOOST_MATH_GPU_ENABLED RealType mean()const; // mean default 1.
BOOST_MATH_GPU_ENABLED RealType scale()const; // Optional scale, default 1 (unscaled).
BOOST_MATH_GPU_ENABLED RealType shape()const; // Shape = scale/mean.
};
typedef inverse_gaussian_distribution<double> inverse_gaussian;

Expand Down Expand Up @@ -90,26 +90,28 @@ Another related parameterisation, the __wald_distrib (where mean [mu] is unity)

[h4 Member Functions]

inverse_gaussian_distribution(RealType df = 1, RealType scale = 1); // optionally scaled.
BOOST_MATH_GPU_ENABLED inverse_gaussian_distribution(RealType df = 1, RealType scale = 1); // optionally scaled.

Constructs an inverse_gaussian distribution with [mu] mean,
and scale [lambda], with both default values 1.

Requires that both the mean [mu] parameter and scale [lambda] are greater than zero,
otherwise calls __domain_error.

RealType mean()const;
BOOST_MATH_GPU_ENABLED RealType mean()const;

Returns the mean [mu] parameter of this distribution.

RealType scale()const;
BOOST_MATH_GPU_ENABLED RealType scale()const;

Returns the scale [lambda] parameter of this distribution.

[h4 Non-member Accessors]

All the [link math_toolkit.dist_ref.nmp usual non-member accessor functions] that are generic to all
distributions are supported: __usual_accessors.
For this distribution all non-member accessor functions are marked with `BOOST_MATH_GPU_ENABLED` and can
be run on both host and device.

The domain of the random variate is \[0,+[infin]).
[note Unlike some definitions, this implementation supports a random variate
Expand Down
14 changes: 8 additions & 6 deletions doc/distributions/lognormal.qbk
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@
typedef RealType value_type;
typedef Policy policy_type;
// Construct:
lognormal_distribution(RealType location = 0, RealType scale = 1);
BOOST_MATH_GPU_ENABLED lognormal_distribution(RealType location = 0, RealType scale = 1);
// Accessors:
RealType location()const;
RealType scale()const;
BOOST_MATH_GPU_ENABLED RealType location()const;
BOOST_MATH_GPU_ENABLED RealType scale()const;
};

}} // namespaces
Expand Down Expand Up @@ -51,7 +51,7 @@ The next graph illustrates the effect of the scale parameter on the PDF:

[h4 Member Functions]

lognormal_distribution(RealType location = 0, RealType scale = 1);
BOOST_MATH_GPU_ENABLED lognormal_distribution(RealType location = 0, RealType scale = 1);

Constructs a lognormal distribution with location /location/ and
scale /scale/.
Expand All @@ -65,18 +65,20 @@ logarithm of the random variate.
Requires that the scale parameter is greater than zero, otherwise calls
__domain_error.

RealType location()const;
BOOST_MATH_GPU_ENABLED RealType location()const;

Returns the /location/ parameter of this distribution.

RealType scale()const;
BOOST_MATH_GPU_ENABLED RealType scale()const;

Returns the /scale/ parameter of this distribution.

[h4 Non-member Accessors]

All the [link math_toolkit.dist_ref.nmp usual non-member accessor functions] that are generic to all
distributions are supported: __usual_accessors.
For this distribution all non-member accessor functions are marked with `BOOST_MATH_GPU_ENABLED` and can
be run on both host and device.

The domain of the random variable is \[0,+[infin]\].

Expand Down
18 changes: 10 additions & 8 deletions doc/distributions/nc_beta.qbk
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@
typedef Policy policy_type;

// Constructor:
non_central_beta_distribution(RealType alpha, RealType beta, RealType lambda);
BOOST_MATH_GPU_ENABLED non_central_beta_distribution(RealType alpha, RealType beta, RealType lambda);

// Accessor to shape parameters:
RealType alpha()const;
RealType beta()const;
BOOST_MATH_GPU_ENABLED RealType alpha()const;
BOOST_MATH_GPU_ENABLED RealType beta()const;

// Accessor to non-centrality parameter lambda:
RealType non_centrality()const;
BOOST_MATH_GPU_ENABLED RealType non_centrality()const;
};

}} // namespaces
Expand Down Expand Up @@ -59,22 +59,22 @@ for different values of [lambda]:

[h4 Member Functions]

non_central_beta_distribution(RealType a, RealType b, RealType lambda);
BOOST_MATH_GPU_ENABLED non_central_beta_distribution(RealType a, RealType b, RealType lambda);

Constructs a noncentral beta distribution with shape parameters /a/ and /b/
and non-centrality parameter /lambda/.

Requires a > 0, b > 0 and lambda >= 0, otherwise calls __domain_error.

RealType alpha()const;
BOOST_MATH_GPU_ENABLED RealType alpha()const;

Returns the parameter /a/ from which this object was constructed.

RealType beta()const;
BOOST_MATH_GPU_ENABLED RealType beta()const;

Returns the parameter /b/ from which this object was constructed.

RealType non_centrality()const;
BOOST_MATH_GPU_ENABLED RealType non_centrality()const;

Returns the parameter /lambda/ from which this object was constructed.

Expand All @@ -83,6 +83,8 @@ Returns the parameter /lambda/ from which this object was constructed.
Most of the [link math_toolkit.dist_ref.nmp usual non-member accessor functions]
are supported: __cdf, __pdf, __quantile, __mean, __variance, __sd,
__median, __mode, __hazard, __chf, __range and __support.
For this distribution these functions are marked with `BOOST_MATH_GPU_ENABLED` and can
be run on both host and device.

Mean and variance are implemented using hypergeometric pfq functions and relations given in
[@http://reference.wolfram.com/mathematica/ref/NoncentralBetaDistribution.html Wolfram Noncentral Beta Distribution].
Expand Down
35 changes: 18 additions & 17 deletions doc/distributions/nc_chi_squared.qbk
Original file line number Diff line number Diff line change
Expand Up @@ -18,22 +18,22 @@
typedef Policy policy_type;

// Constructor:
non_central_chi_squared_distribution(RealType v, RealType lambda);
BOOST_MATH_GPU_ENABLED non_central_chi_squared_distribution(RealType v, RealType lambda);

// Accessor to degrees of freedom parameter v:
RealType degrees_of_freedom()const;
BOOST_MATH_GPU_ENABLED RealType degrees_of_freedom()const;

// Accessor to non centrality parameter lambda:
RealType non_centrality()const;
BOOST_MATH_GPU_ENABLED RealType non_centrality()const;

// Parameter finders:
static RealType find_degrees_of_freedom(RealType lambda, RealType x, RealType p);
BOOST_MATH_GPU_ENABLED static RealType find_degrees_of_freedom(RealType lambda, RealType x, RealType p);
template <class A, class B, class C>
static RealType find_degrees_of_freedom(const complemented3_type<A,B,C>& c);
BOOST_MATH_GPU_ENABLED static RealType find_degrees_of_freedom(const complemented3_type<A,B,C>& c);

static RealType find_non_centrality(RealType v, RealType x, RealType p);
BOOST_MATH_GPU_ENABLED static RealType find_non_centrality(RealType v, RealType x, RealType p);
template <class A, class B, class C>
static RealType find_non_centrality(const complemented3_type<A,B,C>& c);
BOOST_MATH_GPU_ENABLED static RealType find_non_centrality(const complemented3_type<A,B,C>& c);
};

}} // namespaces
Expand Down Expand Up @@ -70,43 +70,42 @@ for different values of [lambda]:

[h4 Member Functions]

non_central_chi_squared_distribution(RealType v, RealType lambda);
BOOST_MATH_GPU_ENABLED non_central_chi_squared_distribution(RealType v, RealType lambda);

Constructs a Chi-Squared distribution with [nu] degrees of freedom
and non-centrality parameter /lambda/.

Requires [nu] > 0 and lambda >= 0, otherwise calls __domain_error.

RealType degrees_of_freedom()const;
BOOST_MATH_GPU_ENABLED RealType degrees_of_freedom()const;

Returns the parameter [nu] from which this object was constructed.

RealType non_centrality()const;
BOOST_MATH_GPU_ENABLED RealType non_centrality()const;

Returns the parameter /lambda/ from which this object was constructed.


static RealType find_degrees_of_freedom(RealType lambda, RealType x, RealType p);
BOOST_MATH_GPU_ENABLED static RealType find_degrees_of_freedom(RealType lambda, RealType x, RealType p);

This function returns the number of degrees of freedom [nu] such that:
`cdf(non_central_chi_squared<RealType, Policy>(v, lambda), x) == p`

template <class A, class B, class C>
static RealType find_degrees_of_freedom(const complemented3_type<A,B,C>& c);
template <class A, class B, class C>
BOOST_MATH_GPU_ENABLED static RealType find_degrees_of_freedom(const complemented3_type<A,B,C>& c);

When called with argument `boost::math::complement(lambda, x, q)`
this function returns the number of degrees of freedom [nu] such that:

`cdf(complement(non_central_chi_squared<RealType, Policy>(v, lambda), x)) == q`.

static RealType find_non_centrality(RealType v, RealType x, RealType p);
BOOST_MATH_GPU_ENABLED static RealType find_non_centrality(RealType v, RealType x, RealType p);

This function returns the non centrality parameter /lambda/ such that:

`cdf(non_central_chi_squared<RealType, Policy>(v, lambda), x) == p`

template <class A, class B, class C>
static RealType find_non_centrality(const complemented3_type<A,B,C>& c);
template <class A, class B, class C>
BOOST_MATH_GPU_ENABLED static RealType find_non_centrality(const complemented3_type<A,B,C>& c);

When called with argument `boost::math::complement(v, x, q)`
this function returns the non centrality parameter /lambda/ such that:
Expand All @@ -117,6 +116,8 @@ this function returns the non centrality parameter /lambda/ such that:

All the [link math_toolkit.dist_ref.nmp usual non-member accessor functions]
that are generic to all distributions are supported: __usual_accessors.
For this distribution all non-member accessor functions are marked with `BOOST_MATH_GPU_ENABLED` and can
be run on both host and device.

The domain of the random variable is \[0, +[infin]\].

Expand Down
18 changes: 10 additions & 8 deletions doc/distributions/nc_f.qbk
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@
typedef Policy policy_type;

// Constructor:
non_central_f_distribution(RealType v1, RealType v2, RealType lambda);
BOOST_MATH_GPU_ENABLED non_central_f_distribution(RealType v1, RealType v2, RealType lambda);

// Accessor to degrees_of_freedom parameters v1 & v2:
RealType degrees_of_freedom1()const;
RealType degrees_of_freedom2()const;
BOOST_MATH_GPU_ENABLED RealType degrees_of_freedom1()const;
BOOST_MATH_GPU_ENABLED RealType degrees_of_freedom2()const;

// Accessor to non-centrality parameter lambda:
RealType non_centrality()const;
BOOST_MATH_GPU_ENABLED RealType non_centrality()const;
};

}} // namespaces
Expand Down Expand Up @@ -55,29 +55,31 @@ for different values of [lambda]:

[h4 Member Functions]

non_central_f_distribution(RealType v1, RealType v2, RealType lambda);
BOOST_MATH_GPU_ENABLED non_central_f_distribution(RealType v1, RealType v2, RealType lambda);

Constructs a non-central beta distribution with parameters /v1/ and /v2/
and non-centrality parameter /lambda/.

Requires /v1/ > 0, /v2/ > 0 and lambda >= 0, otherwise calls __domain_error.

RealType degrees_of_freedom1()const;
BOOST_MATH_GPU_ENABLED RealType degrees_of_freedom1()const;

Returns the parameter /v1/ from which this object was constructed.

RealType degrees_of_freedom2()const;
BOOST_MATH_GPU_ENABLED RealType degrees_of_freedom2()const;

Returns the parameter /v2/ from which this object was constructed.

RealType non_centrality()const;
BOOST_MATH_GPU_ENABLED RealType non_centrality()const;

Returns the non-centrality parameter /lambda/ from which this object was constructed.

[h4 Non-member Accessors]

All the [link math_toolkit.dist_ref.nmp usual non-member accessor functions]
that are generic to all distributions are supported: __usual_accessors.
For this distribution all non-member accessor functions are marked with `BOOST_MATH_GPU_ENABLED` and can
be run on both host and device.

The domain of the random variable is \[0, +[infin]\].

Expand Down
30 changes: 16 additions & 14 deletions doc/distributions/negative_binomial.qbk
Original file line number Diff line number Diff line change
Expand Up @@ -17,28 +17,28 @@
typedef RealType value_type;
typedef Policy policy_type;
// Constructor from successes and success_fraction:
negative_binomial_distribution(RealType r, RealType p);
BOOST_MATH_GPU_ENABLED negative_binomial_distribution(RealType r, RealType p);

// Parameter accessors:
RealType success_fraction() const;
RealType successes() const;
BOOST_MATH_GPU_ENABLED RealType success_fraction() const;
BOOST_MATH_GPU_ENABLED RealType successes() const;

// Bounds on success fraction:
static RealType find_lower_bound_on_p(
BOOST_MATH_GPU_ENABLED static RealType find_lower_bound_on_p(
RealType trials,
RealType successes,
RealType probability); // alpha
static RealType find_upper_bound_on_p(
BOOST_MATH_GPU_ENABLED static RealType find_upper_bound_on_p(
RealType trials,
RealType successes,
RealType probability); // alpha

// Estimate min/max number of trials:
static RealType find_minimum_number_of_trials(
BOOST_MATH_GPU_ENABLED static RealType find_minimum_number_of_trials(
RealType k, // Number of failures.
RealType p, // Success fraction.
RealType probability); // Probability threshold alpha.
static RealType find_maximum_number_of_trials(
BOOST_MATH_GPU_ENABLED static RealType find_maximum_number_of_trials(
RealType k, // Number of failures.
RealType p, // Success fraction.
RealType probability); // Probability threshold alpha.
Expand Down Expand Up @@ -112,7 +112,7 @@ poisson([lambda]) = lim [sub r [rarr] [infin]] negative_binomial(r, r / ([lambda

[h5 Construct]

negative_binomial_distribution(RealType r, RealType p);
BOOST_MATH_GPU_ENABLED negative_binomial_distribution(RealType r, RealType p);

Constructor: /r/ is the total number of successes, /p/ is the
probability of success of a single trial.
Expand All @@ -121,11 +121,11 @@ Requires: `r > 0` and `0 <= p <= 1`.

[h5 Accessors]

RealType success_fraction() const; // successes / trials (0 <= p <= 1)
BOOST_MATH_GPU_ENABLED RealType success_fraction() const; // successes / trials (0 <= p <= 1)

Returns the parameter /p/ from which this distribution was constructed.

RealType successes() const; // required successes (r > 0)
BOOST_MATH_GPU_ENABLED RealType successes() const; // required successes (r > 0)

Returns the parameter /r/ from which this distribution was constructed.

Expand All @@ -134,7 +134,7 @@ see __binomial_distrib for more discussion.

[h5 Lower Bound on Parameter p]

static RealType find_lower_bound_on_p(
BOOST_MATH_GPU_ENABLED static RealType find_lower_bound_on_p(
RealType failures,
RealType successes,
RealType probability) // (0 <= alpha <= 1), 0.05 equivalent to 95% confidence.
Expand Down Expand Up @@ -170,7 +170,7 @@ Computational statistics and data analysis, 2005, vol. 48, no3, 605-621].

[h5 Upper Bound on Parameter p]

static RealType find_upper_bound_on_p(
BOOST_MATH_GPU_ENABLED static RealType find_upper_bound_on_p(
RealType trials,
RealType successes,
RealType alpha); // (0 <= alpha <= 1), 0.05 equivalent to 95% confidence.
Expand Down Expand Up @@ -206,7 +206,7 @@ Computational statistics and data analysis, 2005, vol. 48, no3, 605-621].

[h5 Estimating Number of Trials to Ensure at Least a Certain Number of Failures]

static RealType find_minimum_number_of_trials(
BOOST_MATH_GPU_ENABLED static RealType find_minimum_number_of_trials(
RealType k, // number of failures.
RealType p, // success fraction.
RealType alpha); // probability threshold (0.05 equivalent to 95%).
Expand Down Expand Up @@ -236,7 +236,7 @@ of observing k failures or fewer.

[h5 Estimating Number of Trials to Ensure a Maximum Number of Failures or Less]

static RealType find_maximum_number_of_trials(
BOOST_MATH_GPU_ENABLED static RealType find_maximum_number_of_trials(
RealType k, // number of failures.
RealType p, // success fraction.
RealType alpha); // probability threshold (0.05 equivalent to 95%).
Expand Down Expand Up @@ -266,6 +266,8 @@ of observing more than k failures.

All the [link math_toolkit.dist_ref.nmp usual non-member accessor functions]
that are generic to all distributions are supported: __usual_accessors.
For this distribution all non-member accessor functions are marked with `BOOST_MATH_GPU_ENABLED` and can
be run on both host and device.

However it's worth taking a moment to define what these actually mean in
the context of this distribution:
Expand Down
Loading