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

Move constraint transforms to their own folder #3039

Merged

Conversation

spinkney
Copy link
Collaborator

@spinkney spinkney commented Mar 24, 2024

closes #3027

I moved the constraint transforms and associated "free" files to constraint folders.

stan -> math -> fwd -> constraint
stan -> math -> prim -> constraint
stan -> math -> rev -> constraint

stan -> math -> opencl -> prim -> constraint
stan -> math -> opencl -> rev -> constraint

# testing framework
test -> unit -> math -> prim -> constraint
test -> unit -> math -> opencl -> rev -> constraint 

@SteveBronder not sure if I got everything here. Please double check.

@spinkney
Copy link
Collaborator Author

@WardBrian I'm getting this error in the windows header checks

./stan/math/prim/prob/wiener5_lpdf.hpp:642:17: error: no member named 'apply' in namespace 'stan::math'

As far as I can tell none of the files I touched are used here or in the includes for the wiener5_lpdf file. Is there something I'm missing here?

@andrjohns
Copy link
Collaborator

@WardBrian I'm getting this error in the windows header checks

./stan/math/prim/prob/wiener5_lpdf.hpp:642:17: error: no member named 'apply' in namespace 'stan::math'

As far as I can tell none of the files I touched are used here or in the includes for the wiener5_lpdf file. Is there something I'm missing here?

You just need to add #include <stan/math/prim/functor/apply.hpp>. wiener5_lpdf only has #include <stan/math/prim/fun.hpp>, so it looks the math::apply was getting included via one of the constrain functions instead of directly.

This does raise a related issue where downstream implementations might break if they're using #include <stan/math/prim/fun.hpp> and then assuming that it will pull in the constrain functions

@spinkney
Copy link
Collaborator Author

@serban-nicusor-toptal can you restart the failed tests? It's something about failed to download ghostscript.

@SteveBronder
Copy link
Collaborator

Should we still have the old files and just have them include the new files? We can remove them from prim.hpp / rev.hpp and only include the new ones. But that would make this backwards compatible

@spinkney
Copy link
Collaborator Author

Should we still have the old files and just have them include the new files? We can remove them from prim.hpp / rev.hpp and only include the new ones. But that would make this backwards compatible

I'm ok with that. I just wanted to make sure that this works without those files first. I'm getting errors in runTests.py with that I don't know how to fix.

make: *** [<builtin>: test/unit/math/mix/fun_4_test.o] Terminated
make: *** [<builtin>: test/unit/math/mix/fun_6_test.o] Terminated
make: *** [<builtin>: test/unit/math/mix/fun_22_test.o] Terminated
make: *** [<builtin>: test/unit/math/mix/fun_7_test.o] Terminated

@WardBrian
Copy link
Member

But that would make this backwards compatible

Isn't the idea that the next Math release will have a major version bump anyway?

@SteveBronder
Copy link
Collaborator

Yes though having the files would just make the jump a little easier. Though for 5.0 I think it's also fine not to include them

@spinkney
Copy link
Collaborator Author

@SteveBronder I think this will now pass all tests. Once it does please take a look

@SteveBronder
Copy link
Collaborator

This looks good imo. @syclik should we make a 5.0 branch and merge all these PRs onto there once they are approved? I think that branch will have this PR, #2928, and #2995. Maybe #2965 should also go there?

@stan-buildbot
Copy link
Contributor


Name Old Result New Result Ratio Performance change( 1 - new / old )
arma/arma.stan 0.19 0.19 1.0 0.27% faster
low_dim_corr_gauss/low_dim_corr_gauss.stan 0.01 0.01 1.03 3.13% faster
gp_regr/gen_gp_data.stan 0.02 0.02 1.04 3.58% faster
gp_regr/gp_regr.stan 0.11 0.11 1.02 2.21% faster
sir/sir.stan 77.56 77.17 1.01 0.51% faster
irt_2pl/irt_2pl.stan 4.0 3.8 1.05 5.05% faster
eight_schools/eight_schools.stan 0.05 0.05 1.04 3.9% faster
pkpd/sim_one_comp_mm_elim_abs.stan 0.25 0.24 1.04 4.29% faster
pkpd/one_comp_mm_elim_abs.stan 18.06 17.72 1.02 1.86% faster
garch/garch.stan 0.46 0.44 1.06 5.44% faster
low_dim_gauss_mix/low_dim_gauss_mix.stan 2.77 2.74 1.01 1.02% faster
arK/arK.stan 1.63 1.6 1.02 2.01% faster
gp_pois_regr/gp_pois_regr.stan 2.51 2.43 1.03 2.92% faster
low_dim_gauss_mix_collapse/low_dim_gauss_mix_collapse.stan 9.28 8.95 1.04 3.56% faster
performance.compilation 175.61 183.07 0.96 -4.25% slower
Mean result: 1.024809273047251

Jenkins Console Log
Blue Ocean
Commit hash: 14dfa9321f82f4102f9b572c68f1e7440177abf4


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

@syclik
Copy link
Member

syclik commented Apr 2, 2024

@SteveBronder, yes, absolutely! (to the 5.0 branch)

@SteveBronder SteveBronder changed the base branch from develop to 5.0-breaking-changes April 2, 2024 16:25
@SteveBronder SteveBronder changed the base branch from 5.0-breaking-changes to develop April 2, 2024 16:33
@SteveBronder
Copy link
Collaborator

Oh, @syclik the tests only happen if we are merging to develop. So let's only move branches over to be merged to the 5.0 branch once all tests pass and we approve the PR

@stan-buildbot
Copy link
Contributor


Name Old Result New Result Ratio Performance change( 1 - new / old )
arma/arma.stan 0.22 0.22 1.0 0.02% faster
low_dim_corr_gauss/low_dim_corr_gauss.stan 0.01 0.01 0.92 -8.86% slower
gp_regr/gen_gp_data.stan 0.03 0.02 1.57 36.22% faster
gp_regr/gp_regr.stan 0.12 0.11 1.1 9.0% faster
sir/sir.stan 85.81 83.35 1.03 2.87% faster
irt_2pl/irt_2pl.stan 4.34 4.25 1.02 2.2% faster
eight_schools/eight_schools.stan 0.07 0.06 1.09 8.07% faster
pkpd/sim_one_comp_mm_elim_abs.stan 0.28 0.28 1.0 0.41% faster
pkpd/one_comp_mm_elim_abs.stan 20.43 19.54 1.05 4.37% faster
garch/garch.stan 0.53 0.48 1.12 10.46% faster
low_dim_gauss_mix/low_dim_gauss_mix.stan 3.02 2.94 1.03 2.59% faster
arK/arK.stan 1.87 1.8 1.04 3.76% faster
gp_pois_regr/gp_pois_regr.stan 2.85 2.64 1.08 7.31% faster
low_dim_gauss_mix_collapse/low_dim_gauss_mix_collapse.stan 10.05 9.48 1.06 5.66% faster
performance.compilation 226.94 213.64 1.06 5.86% faster
Mean result: 1.077245037753359

Jenkins Console Log
Blue Ocean
Commit hash: 0fcf10855f923eb24c8e9958f1f19fde97572810


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: 2911.834
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

@SteveBronder SteveBronder mentioned this pull request Apr 18, 2024
7 tasks
@SteveBronder SteveBronder changed the base branch from develop to 5.0-breaking-changes April 18, 2024 16:47
@SteveBronder SteveBronder merged commit 6a87593 into 5.0-breaking-changes Apr 18, 2024
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.

can we reorganize to put the constraint transforms into their own folder?
6 participants