This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * \ingroup opencl | |
| * \defgroup opencl_kernel_generator OpenCL Kernel Generator | |
| * | |
| * The OpenCL kernel generator is used to combine multiple matrix operations into a | |
| * single OpenCL kernel. This is much simpler than writing multi-operation kernels by | |
| * hand. | |
| * | |
| * Because global GPU memory loads and stores are relativly slow compared to | |
| * calculations in a kernel, using one kernel for multiple operations is faster than using one kernel |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| USER_OPTIM_FLAGS= -pipe -fPIC -O3 -mtune=native -march=native | |
| # I couldn't tell whether the opencl headers we use existed in `StanHeaders` on cran | |
| # So I do a | |
| # git clone --recursive https://github.com/stan-dev/rstan | |
| # and then include the OpenCL headers | |
| USER_OPENCL_FLAGS= -I"/path_to_rstan/rstan/StanHeaders/inst/include/mathlib/lib/opencl_2.1.0" | |
| # You can get these with clinfo -l | |
| USER_OPENCL_FLAGS+= -DSTAN_OPENCL=1 -DOPENCL_DEVICE_ID=1 -DOPENCL_PLATFORM_ID=2 -lOpenCL | |
| # Some extra bits we need | |
| USER_OPENCL_FLAGS+= -DCL_HPP_TARGET_OPENCL_VERSION=120 -DCL_HPP_MINIMUM_OPENCL_VERSION=120 -DCL_HPP_ENABLE_EXCEPTIONS -Wno-ignored-attributes |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| data { | |
| int<lower = 1> nSubjects; | |
| int nIIV; | |
| } | |
| parameters { | |
| cholesky_factor_corr[nIIV] L; | |
| matrix[nIIV, nSubjects] etaStd; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <stan/math/prim/core.hpp> | |
| #include <stan/math.hpp> | |
| #include <gtest/gtest.h> | |
| #include <algorithm> | |
| #include <sstream> | |
| #include <tuple> | |
| #include <vector> | |
| std::ostream* msgs = nullptr; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| bench | time | cpu | iters | type | test | |
|---|---|---|---|---|---|---|
| add_copy_bench/2_mean | 187 ns | 187 ns | 35 | mean | copy | |
| add_copy_bench/2_median | 186 ns | 186 ns | 35 | median | copy | |
| add_copy_bench/2_stddev | 3.10 ns | 3.09 ns | 35 | stddev | copy | |
| add_copy_bench/4_mean | 335 ns | 334 ns | 35 | mean | copy | |
| add_copy_bench/4_median | 333 ns | 333 ns | 35 | median | copy | |
| add_copy_bench/4_stddev | 3.46 ns | 3.46 ns | 35 | stddev | copy | |
| add_copy_bench/8_mean | 1159 ns | 1159 ns | 35 | mean | copy | |
| add_copy_bench/8_median | 1156 ns | 1156 ns | 35 | median | copy | |
| add_copy_bench/8_stddev | 9.47 ns | 9.47 ns | 35 | stddev | copy |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Code generated by stanc acfb4612 | |
| #include <stan/model/model_header.hpp> | |
| namespace example_model_namespace { | |
| template <typename T, typename S> | |
| std::vector<T> resize_to_match__(std::vector<T> &dst, | |
| const std::vector<S> &src) { | |
| dst.resize(src.size()); | |
| return dst; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Code generated by stanc acfb4612 | |
| #include <stan/model/model_header.hpp> | |
| namespace blah_model_namespace { | |
| template <typename T, typename S> | |
| std::vector<T> resize_to_match__(std::vector<T> &dst, | |
| const std::vector<S> &src) { | |
| dst.resize(src.size()); | |
| return dst; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| test_x = runif(10000, min = 0, 1000) | |
| test_x = test_x * 1e+10 | |
| orig_signif = function(x, digits = 1) { | |
| xx = abs(x); | |
| return(trunc((10^((floor(log10(x)) * -1) + digits - 1)) * x)) | |
| } | |
| new_signif = function(x, digits = 1) { | |
| xx = abs(x); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // generated with brms 2.10.3 | |
| functions { | |
| } | |
| data { | |
| int<lower=1> N; // number of observations | |
| vector[N] Y; // response variable | |
| // data needed for ARMA correlations | |
| int<lower=0> Kar; // AR order | |
| int<lower=0> Kma; // MA order | |
| // number of lags per observation |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Code generated by Stan version 2.21.0 | |
| #include <stan/model/model_header.hpp> | |
| namespace test_mod1_model_namespace { | |
| using std::istream; | |
| using std::string; | |
| using std::stringstream; | |
| using std::vector; |