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

Re-Implementation of Hypergeometric PFQ gradient function #2961

Merged
merged 39 commits into from
Apr 13, 2024
Merged

Conversation

andrjohns
Copy link
Collaborator

Summary

This PR rewrites the grad_pFq function to use a significantly simpler form of the gradient definition (now requiring only one infinite sum instead of two nested ones). The grad_pFq function now performs on par with the existing grad_2F1 and grad_3F2 functions in terms of both speed and accuracy.

The gradient calculations are also now amenable to the autodiff testing framework, and so new mix tests have been added.

Tests

Existing tests for equality with grad_2F1 and grad_3F2 should still pass. Additional mix tests using the autodiff testing framework have been added.

Side Effects

N/A

Release notes

Gradients for the hypergeometric_pFq function rewritten for increased speed and stability

Checklist

  • Math issue #(issue number)

  • Copyright holder: Andrew Johnson

    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

@andrjohns
Copy link
Collaborator Author

@spinkney would you be able to have a look at this when you get a minute? Once this is in I'll be able to start adding the rest of the hypergeometric functions from Boost

@spinkney
Copy link
Collaborator

spinkney commented Oct 8, 2023

This is great news! I may have some time tomorrow to look at this. Can you add some documentation about the simplified way the derivatives are calculated?

@andrjohns
Copy link
Collaborator Author

This is great news! I may have some time tomorrow to look at this. Can you add some documentation about the simplified way the derivatives are calculated?

Thanks! Doc added. It's essentially taking advantage of the fact that we'll always have the calculated value of the hypergeometric_pfq function when we need the gradients, so we can use this definition: https://functions.wolfram.com/HypergeometricFunctions/HypergeometricPFQ/20/01/01/0001/

Then because of the digamma recurrence relationship, we can cancel out the digamma(a_j) from both sides of the operation

Copy link
Member

@syclik syclik left a comment

Choose a reason for hiding this comment

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

@andrjohns, can you annotate the code to make the review easier?

Some general things that would help immensely:

  1. replace auto with proper types when it's straightforward. It's being overused and making it absolutely hard to read.
  2. explain some of the bigger blocks that changed.
  3. explain some of the name changes. I'm seeing minor differences and I'm not sure if there are other non-C++ idioms bleeding into this PR. For example, calc_z -> CalcZ? I'm not saying it's better or worse, just want to know what the motivation is and whether it's consistent.


namespace stan {
namespace math {
namespace internal {
template <typename T>
inline auto binarysign(const T& x) {
Copy link
Member

Choose a reason for hiding this comment

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

  1. Don't we have a sign function?
  2. This function shouldn't live here.

@stan-buildbot
Copy link
Contributor


Name Old Result New Result Ratio Performance change( 1 - new / old )
arma/arma.stan 0.19 0.2 0.96 -4.22% slower
low_dim_corr_gauss/low_dim_corr_gauss.stan 0.01 0.01 1.07 6.77% faster
gp_regr/gen_gp_data.stan 0.02 0.02 1.08 7.56% faster
gp_regr/gp_regr.stan 0.11 0.11 1.02 1.96% faster
sir/sir.stan 83.04 81.84 1.01 1.43% faster
irt_2pl/irt_2pl.stan 4.09 4.16 0.98 -1.67% slower
eight_schools/eight_schools.stan 0.05 0.06 0.9 -11.06% slower
pkpd/sim_one_comp_mm_elim_abs.stan 0.33 0.28 1.16 13.65% faster
pkpd/one_comp_mm_elim_abs.stan 19.81 19.37 1.02 2.23% faster
garch/garch.stan 0.49 0.49 1.02 1.5% faster
low_dim_gauss_mix/low_dim_gauss_mix.stan 3.01 3.99 0.76 -32.43% slower
arK/arK.stan 1.72 1.76 0.97 -2.7% slower
gp_pois_regr/gp_pois_regr.stan 2.66 2.71 0.98 -2.02% slower
low_dim_gauss_mix_collapse/low_dim_gauss_mix_collapse.stan 9.8 10.11 0.97 -3.2% slower
performance.compilation 210.21 206.33 1.02 1.85% faster
Mean result: 0.9950364234372465

Jenkins Console Log
Blue Ocean
Commit hash: d1c6b7c740d486cba81292100a0c469eb4b6b4cb


Machine information No LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 20.04.3 LTS Release: 20.04 Codename: focal

CPU:
Architecture: x86_64
CPU op-mode(s): 32-bit, 64-bit
Byte Order: Little Endian
Address sizes: 46 bits physical, 48 bits virtual
CPU(s): 80
On-line CPU(s) list: 0-79
Thread(s) per core: 2
Core(s) per socket: 20
Socket(s): 2
NUMA node(s): 2
Vendor ID: GenuineIntel
CPU family: 6
Model: 85
Model name: Intel(R) Xeon(R) Gold 6148 CPU @ 2.40GHz
Stepping: 4
CPU MHz: 2400.000
CPU max MHz: 3700.0000
CPU min MHz: 1000.0000
BogoMIPS: 4800.00
Virtualization: VT-x
L1d cache: 1.3 MiB
L1i cache: 1.3 MiB
L2 cache: 40 MiB
L3 cache: 55 MiB
NUMA node0 CPU(s): 0,2,4,6,8,10,12,14,16,18,20,22,24,26,28,30,32,34,36,38,40,42,44,46,48,50,52,54,56,58,60,62,64,66,68,70,72,74,76,78
NUMA node1 CPU(s): 1,3,5,7,9,11,13,15,17,19,21,23,25,27,29,31,33,35,37,39,41,43,45,47,49,51,53,55,57,59,61,63,65,67,69,71,73,75,77,79
Vulnerability Gather data sampling: Mitigation; Microcode
Vulnerability Itlb multihit: KVM: Mitigation: VMX disabled
Vulnerability L1tf: Mitigation; PTE Inversion; VMX conditional cache flushes, SMT vulnerable
Vulnerability Mds: Mitigation; Clear CPU buffers; SMT vulnerable
Vulnerability Meltdown: Mitigation; PTI
Vulnerability Mmio stale data: Mitigation; Clear CPU buffers; SMT vulnerable
Vulnerability Retbleed: Mitigation; IBRS
Vulnerability Spec store bypass: Mitigation; Speculative Store Bypass disabled via prctl
Vulnerability Spectre v1: Mitigation; usercopy/swapgs barriers and __user pointer sanitization
Vulnerability Spectre v2: Mitigation; IBRS, IBPB conditional, STIBP conditional, RSB filling, PBRSB-eIBRS Not affected
Vulnerability Srbds: Not affected
Vulnerability Tsx async abort: Mitigation; Clear CPU buffers; SMT vulnerable
Flags: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc art arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc cpuid aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid dca sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm 3dnowprefetch cpuid_fault epb cat_l3 cdp_l3 invpcid_single pti intel_ppin ssbd mba ibrs ibpb stibp tpr_shadow vnmi flexpriority ept vpid ept_ad fsgsbase tsc_adjust bmi1 hle avx2 smep bmi2 erms invpcid rtm cqm mpx rdt_a avx512f avx512dq rdseed adx smap clflushopt clwb intel_pt avx512cd avx512bw avx512vl xsaveopt xsavec xgetbv1 xsaves cqm_llc cqm_occup_llc cqm_mbm_total cqm_mbm_local dtherm ida arat pln pts hwp hwp_act_window hwp_epp hwp_pkg_req pku ospke md_clear flush_l1d arch_capabilities

G++:
g++ (Ubuntu 9.4.0-1ubuntu1~20.04) 9.4.0
Copyright (C) 2019 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Clang:
clang version 10.0.0-4ubuntu1
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin

@andrjohns
Copy link
Collaborator Author

@andrjohns, can you annotate the code to make the review easier?

Some general things that would help immensely:

1. replace `auto` with proper types when it's straightforward. It's being overused and making it absolutely hard to read.

2. explain some of the bigger blocks that changed.

3. explain some of the name changes. I'm seeing minor differences and I'm not sure if there are other non-C++ idioms bleeding into this PR. For example, `calc_z` -> `CalcZ`? I'm not saying it's better or worse, just want to know what the motivation is and whether it's consistent.

@syclik

Returning to this PR since there's been some demand for hypergeometric functions on the forums

  1. done
  2. A completely different algorithm has been implemented (math in the doxygen), so I don't think it makes much sense to explain changes in code blocks tbh
  3. The name were mostly just for consistency with the rest of the math library, where we tend to use camel-case for template values. Happy to revert if unnecessary.

@stan-buildbot
Copy link
Contributor


Name Old Result New Result Ratio Performance change( 1 - new / old )
arma/arma.stan 0.19 0.18 1.08 7.06% faster
low_dim_corr_gauss/low_dim_corr_gauss.stan 0.01 0.01 1.05 5.03% faster
gp_regr/gen_gp_data.stan 0.02 0.02 1.06 5.63% faster
gp_regr/gp_regr.stan 0.11 0.1 1.04 3.43% faster
sir/sir.stan 77.44 74.65 1.04 3.59% faster
irt_2pl/irt_2pl.stan 3.83 3.84 1.0 -0.14% slower
eight_schools/eight_schools.stan 0.05 0.05 0.99 -0.73% slower
pkpd/sim_one_comp_mm_elim_abs.stan 0.25 0.25 1.01 1.26% faster
pkpd/one_comp_mm_elim_abs.stan 17.82 18.22 0.98 -2.24% slower
garch/garch.stan 0.45 0.46 0.99 -0.91% slower
low_dim_gauss_mix/low_dim_gauss_mix.stan 2.75 2.82 0.98 -2.48% slower
arK/arK.stan 1.62 1.64 0.99 -1.3% slower
gp_pois_regr/gp_pois_regr.stan 2.48 2.52 0.99 -1.32% slower
low_dim_gauss_mix_collapse/low_dim_gauss_mix_collapse.stan 9.03 9.31 0.97 -3.09% slower
performance.compilation 174.83 174.73 1.0 0.06% faster
Mean result: 1.0103386921027002

Jenkins Console Log
Blue Ocean
Commit hash: d1c6b7c740d486cba81292100a0c469eb4b6b4cb


Machine information No LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 20.04.3 LTS Release: 20.04 Codename: focal

CPU:
Architecture: x86_64
CPU op-mode(s): 32-bit, 64-bit
Byte Order: Little Endian
Address sizes: 46 bits physical, 48 bits virtual
CPU(s): 80
On-line CPU(s) list: 0-79
Thread(s) per core: 2
Core(s) per socket: 20
Socket(s): 2
NUMA node(s): 2
Vendor ID: GenuineIntel
CPU family: 6
Model: 85
Model name: Intel(R) Xeon(R) Gold 6148 CPU @ 2.40GHz
Stepping: 4
CPU MHz: 2400.000
CPU max MHz: 3700.0000
CPU min MHz: 1000.0000
BogoMIPS: 4800.00
Virtualization: VT-x
L1d cache: 1.3 MiB
L1i cache: 1.3 MiB
L2 cache: 40 MiB
L3 cache: 55 MiB
NUMA node0 CPU(s): 0,2,4,6,8,10,12,14,16,18,20,22,24,26,28,30,32,34,36,38,40,42,44,46,48,50,52,54,56,58,60,62,64,66,68,70,72,74,76,78
NUMA node1 CPU(s): 1,3,5,7,9,11,13,15,17,19,21,23,25,27,29,31,33,35,37,39,41,43,45,47,49,51,53,55,57,59,61,63,65,67,69,71,73,75,77,79
Vulnerability Gather data sampling: Mitigation; Microcode
Vulnerability Itlb multihit: KVM: Mitigation: VMX disabled
Vulnerability L1tf: Mitigation; PTE Inversion; VMX conditional cache flushes, SMT vulnerable
Vulnerability Mds: Mitigation; Clear CPU buffers; SMT vulnerable
Vulnerability Meltdown: Mitigation; PTI
Vulnerability Mmio stale data: Mitigation; Clear CPU buffers; SMT vulnerable
Vulnerability Retbleed: Mitigation; IBRS
Vulnerability Spec store bypass: Mitigation; Speculative Store Bypass disabled via prctl
Vulnerability Spectre v1: Mitigation; usercopy/swapgs barriers and __user pointer sanitization
Vulnerability Spectre v2: Mitigation; IBRS, IBPB conditional, STIBP conditional, RSB filling, PBRSB-eIBRS Not affected
Vulnerability Srbds: Not affected
Vulnerability Tsx async abort: Mitigation; Clear CPU buffers; SMT vulnerable
Flags: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc art arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc cpuid aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid dca sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm 3dnowprefetch cpuid_fault epb cat_l3 cdp_l3 invpcid_single pti intel_ppin ssbd mba ibrs ibpb stibp tpr_shadow vnmi flexpriority ept vpid ept_ad fsgsbase tsc_adjust bmi1 hle avx2 smep bmi2 erms invpcid rtm cqm mpx rdt_a avx512f avx512dq rdseed adx smap clflushopt clwb intel_pt avx512cd avx512bw avx512vl xsaveopt xsavec xgetbv1 xsaves cqm_llc cqm_occup_llc cqm_mbm_total cqm_mbm_local dtherm ida arat pln pts hwp hwp_act_window hwp_epp hwp_pkg_req pku ospke md_clear flush_l1d arch_capabilities

G++:
g++ (Ubuntu 9.4.0-1ubuntu1~20.04) 9.4.0
Copyright (C) 2019 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Clang:
clang version 10.0.0-4ubuntu1
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin

@syclik syclik self-assigned this Feb 26, 2024
@syclik
Copy link
Member

syclik commented Feb 26, 2024

Thanks for the updates!

  1. Re: auto. Thank you!
  2. Re: describing code blocks. No need! Thanks for adding the math in the doxygen comment; I'll give it a render and make sure it aligns with the code later.
  3. Re: CalcZ. I now understand what you were doing. Would you mind changing the bool template parameters back to underscore case? I'm pretty sure we left booleans as underscore case and actual types as CamelCase. Does that make sense?

Here's where it stands:

  • Action is on me to read the math and make sure the implementation follows correctly. (If there's anything tricky, I'll put down comments.)
  • If the intent is for grad_pFq() to not be exposed, then I think the function signature could stay. If it's meant to be exposed, we should redsign the function signature.
  • The PR should go in once the math is checked; if there are any minor changes to be made, I'll try to add them as suggestions and we can merge and get it in.

@andrjohns
Copy link
Collaborator Author

Thanks for the updates!

1. Re: auto. Thank you!

2. Re: describing code blocks. No need! Thanks for adding the math in the doxygen comment; I'll give it a render and make sure it aligns with the code later.

3. Re: CalcZ. I now understand what you were doing. Would you mind changing the `bool` template parameters back to underscore case? I'm pretty sure we left booleans as underscore case and actual types as CamelCase. Does that make sense?

Here's where it stands:

* Action is on me to read the math and make sure the implementation follows correctly. (If there's anything tricky, I'll put down comments.)

* If the intent is for `grad_pFq()` to not be exposed, then I think the function signature could stay. If it's meant to be exposed, we should redsign the function signature.

* The PR should go in once the math is checked; if there are any minor changes to be made, I'll try to add them as suggestions and we can merge and get it in.

Great, thanks! Just to note about the math, the function was already used for gradient calculations in the hypergeometric_pFq, hypergeometric_3F2, and inv_inc_beta functions, so the existing tests passing provide good support. This PR also updated the hypergeometric_pFq mix tests to use the AD testing framework, so the gradients calculated by grad_pFq are checked against finite-diff

@stan-buildbot
Copy link
Contributor


Name Old Result New Result Ratio Performance change( 1 - new / old )
arma/arma.stan 0.23 0.19 1.25 19.74% faster
low_dim_corr_gauss/low_dim_corr_gauss.stan 0.01 0.01 0.99 -0.67% slower
gp_regr/gen_gp_data.stan 0.02 0.02 1.03 2.79% faster
gp_regr/gp_regr.stan 0.11 0.11 0.99 -0.56% slower
sir/sir.stan 78.63 75.13 1.05 4.45% faster
irt_2pl/irt_2pl.stan 3.91 3.77 1.04 3.58% faster
eight_schools/eight_schools.stan 0.05 0.05 1.06 5.73% faster
pkpd/sim_one_comp_mm_elim_abs.stan 0.25 0.24 1.05 4.5% faster
pkpd/one_comp_mm_elim_abs.stan 18.04 18.08 1.0 -0.23% slower
garch/garch.stan 0.45 0.44 1.02 2.06% faster
low_dim_gauss_mix/low_dim_gauss_mix.stan 2.74 2.77 0.99 -0.76% slower
arK/arK.stan 1.63 1.59 1.03 2.49% faster
gp_pois_regr/gp_pois_regr.stan 2.55 2.43 1.05 4.72% faster
low_dim_gauss_mix_collapse/low_dim_gauss_mix_collapse.stan 9.21 8.88 1.04 3.67% faster
performance.compilation 171.42 175.89 0.97 -2.61% slower
Mean result: 1.0368678657170567

Jenkins Console Log
Blue Ocean
Commit hash: f70fb84db501edcbf822691c02664c43b76287b2


Machine information No LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 20.04.3 LTS Release: 20.04 Codename: focal

CPU:
Architecture: x86_64
CPU op-mode(s): 32-bit, 64-bit
Byte Order: Little Endian
Address sizes: 46 bits physical, 48 bits virtual
CPU(s): 80
On-line CPU(s) list: 0-79
Thread(s) per core: 2
Core(s) per socket: 20
Socket(s): 2
NUMA node(s): 2
Vendor ID: GenuineIntel
CPU family: 6
Model: 85
Model name: Intel(R) Xeon(R) Gold 6148 CPU @ 2.40GHz
Stepping: 4
CPU MHz: 2400.000
CPU max MHz: 3700.0000
CPU min MHz: 1000.0000
BogoMIPS: 4800.00
Virtualization: VT-x
L1d cache: 1.3 MiB
L1i cache: 1.3 MiB
L2 cache: 40 MiB
L3 cache: 55 MiB
NUMA node0 CPU(s): 0,2,4,6,8,10,12,14,16,18,20,22,24,26,28,30,32,34,36,38,40,42,44,46,48,50,52,54,56,58,60,62,64,66,68,70,72,74,76,78
NUMA node1 CPU(s): 1,3,5,7,9,11,13,15,17,19,21,23,25,27,29,31,33,35,37,39,41,43,45,47,49,51,53,55,57,59,61,63,65,67,69,71,73,75,77,79
Vulnerability Gather data sampling: Mitigation; Microcode
Vulnerability Itlb multihit: KVM: Mitigation: VMX disabled
Vulnerability L1tf: Mitigation; PTE Inversion; VMX conditional cache flushes, SMT vulnerable
Vulnerability Mds: Mitigation; Clear CPU buffers; SMT vulnerable
Vulnerability Meltdown: Mitigation; PTI
Vulnerability Mmio stale data: Mitigation; Clear CPU buffers; SMT vulnerable
Vulnerability Retbleed: Mitigation; IBRS
Vulnerability Spec rstack overflow: Not affected
Vulnerability Spec store bypass: Mitigation; Speculative Store Bypass disabled via prctl
Vulnerability Spectre v1: Mitigation; usercopy/swapgs barriers and __user pointer sanitization
Vulnerability Spectre v2: Mitigation; IBRS, IBPB conditional, STIBP conditional, RSB filling, PBRSB-eIBRS Not affected
Vulnerability Srbds: Not affected
Vulnerability Tsx async abort: Mitigation; Clear CPU buffers; SMT vulnerable
Flags: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc art arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc cpuid aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid dca sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm 3dnowprefetch cpuid_fault epb cat_l3 cdp_l3 invpcid_single pti intel_ppin ssbd mba ibrs ibpb stibp tpr_shadow vnmi flexpriority ept vpid ept_ad fsgsbase tsc_adjust bmi1 hle avx2 smep bmi2 erms invpcid rtm cqm mpx rdt_a avx512f avx512dq rdseed adx smap clflushopt clwb intel_pt avx512cd avx512bw avx512vl xsaveopt xsavec xgetbv1 xsaves cqm_llc cqm_occup_llc cqm_mbm_total cqm_mbm_local dtherm ida arat pln pts hwp hwp_act_window hwp_epp hwp_pkg_req pku ospke md_clear flush_l1d arch_capabilities

G++:
g++ (Ubuntu 9.4.0-1ubuntu1~20.04) 9.4.0
Copyright (C) 2019 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Clang:
clang version 10.0.0-4ubuntu1
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin

@andrjohns
Copy link
Collaborator Author

@syclik small ping

@andrjohns
Copy link
Collaborator Author

@syclik can we look at merging this soon? I've got a few functions that depend on it

@syclik
Copy link
Member

syclik commented Apr 11, 2024

@andrjohns, yes. Will take a look tomorrow (eastern time). Thanks for keeping on top of it.

Copy link
Member

@syclik syclik left a comment

Choose a reason for hiding this comment

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

@andrjohns, really minor comments, mostly about the latex.

Once that's done, let's merge! I think the code looks fine. No suggestions for change there (other than the one comment about return type).

stan/math/fwd/fun/hypergeometric_pFq.hpp Outdated Show resolved Hide resolved
stan/math/prim/fun/grad_pFq.hpp Outdated Show resolved Hide resolved
stan/math/prim/fun/grad_pFq.hpp Outdated Show resolved Hide resolved
stan/math/prim/fun/grad_pFq.hpp Outdated Show resolved Hide resolved
stan/math/prim/fun/grad_pFq.hpp Outdated Show resolved Hide resolved
stan/math/prim/fun/grad_pFq.hpp Outdated Show resolved Hide resolved
stan/math/prim/fun/grad_pFq.hpp Outdated Show resolved Hide resolved
stan/math/prim/fun/grad_pFq.hpp Outdated Show resolved Hide resolved
@syclik syclik self-requested a review April 12, 2024 13:23
Copy link
Member

@syclik syclik left a comment

Choose a reason for hiding this comment

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

LGTM!

@syclik
Copy link
Member

syclik commented Apr 12, 2024

@andrjohns, looks great! Please merge when tests are done. (If I see it first, I'll go ahead and merge.)

@stan-buildbot
Copy link
Contributor


Name Old Result New Result Ratio Performance change( 1 - new / old )
arma/arma.stan 0.25 0.3 0.84 -19.28% slower
low_dim_corr_gauss/low_dim_corr_gauss.stan 0.01 0.01 0.87 -15.06% slower
gp_regr/gen_gp_data.stan 0.03 0.02 1.04 4.07% faster
gp_regr/gp_regr.stan 0.11 0.12 0.95 -4.97% slower
sir/sir.stan 82.06 85.37 0.96 -4.04% slower
irt_2pl/irt_2pl.stan 5.51 5.08 1.09 7.91% faster
eight_schools/eight_schools.stan 0.06 0.06 0.97 -3.18% slower
pkpd/sim_one_comp_mm_elim_abs.stan 0.27 0.28 0.98 -1.92% slower
pkpd/one_comp_mm_elim_abs.stan 20.84 20.06 1.04 3.76% faster
garch/garch.stan 0.62 0.58 1.07 6.35% faster
low_dim_gauss_mix/low_dim_gauss_mix.stan 3.52 3.11 1.13 11.79% faster
arK/arK.stan 1.92 1.85 1.04 4.04% faster
gp_pois_regr/gp_pois_regr.stan 2.97 2.95 1.01 0.64% faster
low_dim_gauss_mix_collapse/low_dim_gauss_mix_collapse.stan 10.66 10.51 1.01 1.42% faster
performance.compilation 190.77 208.69 0.91 -9.4% slower
Mean result: 0.9945097341978426

Jenkins Console Log
Blue Ocean
Commit hash: fb02dc7240781e4fe7ea4bc1fb4e06e70079765a


Machine information No LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 20.04.3 LTS Release: 20.04 Codename: focal

CPU:
Architecture: x86_64
CPU op-mode(s): 32-bit, 64-bit
Byte Order: Little Endian
Address sizes: 46 bits physical, 48 bits virtual
CPU(s): 80
On-line CPU(s) list: 0-79
Thread(s) per core: 2
Core(s) per socket: 20
Socket(s): 2
NUMA node(s): 2
Vendor ID: GenuineIntel
CPU family: 6
Model: 85
Model name: Intel(R) Xeon(R) Gold 6148 CPU @ 2.40GHz
Stepping: 4
CPU MHz: 3399.999
CPU max MHz: 3700.0000
CPU min MHz: 1000.0000
BogoMIPS: 4800.00
Virtualization: VT-x
L1d cache: 1.3 MiB
L1i cache: 1.3 MiB
L2 cache: 40 MiB
L3 cache: 55 MiB
NUMA node0 CPU(s): 0,2,4,6,8,10,12,14,16,18,20,22,24,26,28,30,32,34,36,38,40,42,44,46,48,50,52,54,56,58,60,62,64,66,68,70,72,74,76,78
NUMA node1 CPU(s): 1,3,5,7,9,11,13,15,17,19,21,23,25,27,29,31,33,35,37,39,41,43,45,47,49,51,53,55,57,59,61,63,65,67,69,71,73,75,77,79
Vulnerability Gather data sampling: Mitigation; Microcode
Vulnerability Itlb multihit: KVM: Mitigation: VMX disabled
Vulnerability L1tf: Mitigation; PTE Inversion; VMX conditional cache flushes, SMT vulnerable
Vulnerability Mds: Mitigation; Clear CPU buffers; SMT vulnerable
Vulnerability Meltdown: Mitigation; PTI
Vulnerability Mmio stale data: Mitigation; Clear CPU buffers; SMT vulnerable
Vulnerability Retbleed: Mitigation; IBRS
Vulnerability Spec rstack overflow: Not affected
Vulnerability Spec store bypass: Mitigation; Speculative Store Bypass disabled via prctl
Vulnerability Spectre v1: Mitigation; usercopy/swapgs barriers and __user pointer sanitization
Vulnerability Spectre v2: Mitigation; IBRS, IBPB conditional, STIBP conditional, RSB filling, PBRSB-eIBRS Not affected
Vulnerability Srbds: Not affected
Vulnerability Tsx async abort: Mitigation; Clear CPU buffers; SMT vulnerable
Flags: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc art arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc cpuid aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid dca sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm 3dnowprefetch cpuid_fault epb cat_l3 cdp_l3 invpcid_single pti intel_ppin ssbd mba ibrs ibpb stibp tpr_shadow vnmi flexpriority ept vpid ept_ad fsgsbase tsc_adjust bmi1 hle avx2 smep bmi2 erms invpcid rtm cqm mpx rdt_a avx512f avx512dq rdseed adx smap clflushopt clwb intel_pt avx512cd avx512bw avx512vl xsaveopt xsavec xgetbv1 xsaves cqm_llc cqm_occup_llc cqm_mbm_total cqm_mbm_local dtherm ida arat pln pts hwp hwp_act_window hwp_epp hwp_pkg_req pku ospke md_clear flush_l1d arch_capabilities

G++:
g++ (Ubuntu 9.4.0-1ubuntu1~20.04) 9.4.0
Copyright (C) 2019 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Clang:
clang version 10.0.0-4ubuntu1
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin

@syclik syclik merged commit de0c1a7 into develop Apr 13, 2024
8 checks passed
@syclik syclik deleted the grad_pfq-2 branch April 13, 2024 01:16
@WardBrian
Copy link
Member

@andrjohns is the idea to expose the Hypergeometric PFQ functions in stanc3? I saw someone request it on the forums. I can get that up and running if so

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.

None yet

5 participants