Skip to content

Commit e49b8ce

Browse files
authored
RcppArmadillo 15.2.2-0 with Armadillo 15.2.2 (#498)
* Armadillo 15.2.2 * RcppArmadillo 15.2.2-0
1 parent 0828e75 commit e49b8ce

File tree

8 files changed

+113
-25
lines changed

8 files changed

+113
-25
lines changed

ChangeLog

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,15 @@
1+
2025-11-20 Dirk Eddelbuettel <[email protected]>
2+
3+
* DESCRIPTION (Version, Date): RcppArmadillo 15.2.2-0
4+
* inst/NEWS.Rd: Idem
5+
* configure.ac: Idem
6+
* configure: Idem
7+
8+
* inst/include/current/: Sync with Armadillo 15.2.2
9+
10+
* inst/tinytest/test_Rlapack.R: Skip this test involving complex
11+
algebra if on macOS as the LAPACK switch by R affects it
12+
113
2025-11-13 Dirk Eddelbuettel <[email protected]>
214

315
* R/inline.R (inlineCxxPlugin): No longer special-case macOS for

DESCRIPTION

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
Package: RcppArmadillo
22
Type: Package
33
Title: 'Rcpp' Integration for the 'Armadillo' Templated Linear Algebra Library
4-
Version: 15.2.1-0
5-
Date: 2025-10-28
4+
Version: 15.2.2-0
5+
Date: 2025-11-20
66
Authors@R: c(person("Dirk", "Eddelbuettel", role = c("aut", "cre"), email = "[email protected]",
77
comment = c(ORCID = "0000-0001-6419-907X")),
88
person("Romain", "Francois", role = "aut",

configure

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#! /bin/sh
22
# Guess values for system-dependent variables and create Makefiles.
3-
# Generated by GNU Autoconf 2.72 for RcppArmadillo 15.2.1-0.
3+
# Generated by GNU Autoconf 2.72 for RcppArmadillo 15.2.2-0.
44
#
55
# Report bugs to <[email protected]>.
66
#
@@ -603,8 +603,8 @@ MAKEFLAGS=
603603
# Identity of this package.
604604
PACKAGE_NAME='RcppArmadillo'
605605
PACKAGE_TARNAME='rcpparmadillo'
606-
PACKAGE_VERSION='15.2.1-0'
607-
PACKAGE_STRING='RcppArmadillo 15.2.1-0'
606+
PACKAGE_VERSION='15.2.2-0'
607+
PACKAGE_STRING='RcppArmadillo 15.2.2-0'
608608
PACKAGE_BUGREPORT='[email protected]'
609609
PACKAGE_URL=''
610610

@@ -1221,7 +1221,7 @@ if test "$ac_init_help" = "long"; then
12211221
# Omit some internal or obsolete options to make the list less imposing.
12221222
# This message is too long to be a string in the A/UX 3.1 sh.
12231223
cat <<_ACEOF
1224-
'configure' configures RcppArmadillo 15.2.1-0 to adapt to many kinds of systems.
1224+
'configure' configures RcppArmadillo 15.2.2-0 to adapt to many kinds of systems.
12251225
12261226
Usage: $0 [OPTION]... [VAR=VALUE]...
12271227
@@ -1283,7 +1283,7 @@ fi
12831283

12841284
if test -n "$ac_init_help"; then
12851285
case $ac_init_help in
1286-
short | recursive ) echo "Configuration of RcppArmadillo 15.2.1-0:";;
1286+
short | recursive ) echo "Configuration of RcppArmadillo 15.2.2-0:";;
12871287
esac
12881288
cat <<\_ACEOF
12891289
@@ -1364,7 +1364,7 @@ fi
13641364
test -n "$ac_init_help" && exit $ac_status
13651365
if $ac_init_version; then
13661366
cat <<\_ACEOF
1367-
RcppArmadillo configure 15.2.1-0
1367+
RcppArmadillo configure 15.2.2-0
13681368
generated by GNU Autoconf 2.72
13691369
13701370
Copyright (C) 2023 Free Software Foundation, Inc.
@@ -1480,7 +1480,7 @@ cat >config.log <<_ACEOF
14801480
This file contains any messages produced by compilers while
14811481
running configure, to aid debugging if configure makes a mistake.
14821482
1483-
It was created by RcppArmadillo $as_me 15.2.1-0, which was
1483+
It was created by RcppArmadillo $as_me 15.2.2-0, which was
14841484
generated by GNU Autoconf 2.72. Invocation command line was
14851485
14861486
$ $0$ac_configure_args_raw
@@ -3862,7 +3862,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
38623862
# report actual input values of CONFIG_FILES etc. instead of their
38633863
# values after options handling.
38643864
ac_log="
3865-
This file was extended by RcppArmadillo $as_me 15.2.1-0, which was
3865+
This file was extended by RcppArmadillo $as_me 15.2.2-0, which was
38663866
generated by GNU Autoconf 2.72. Invocation command line was
38673867
38683868
CONFIG_FILES = $CONFIG_FILES
@@ -3917,7 +3917,7 @@ ac_cs_config_escaped=`printf "%s\n" "$ac_cs_config" | sed "s/^ //; s/'/'\\\\\\\\
39173917
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
39183918
ac_cs_config='$ac_cs_config_escaped'
39193919
ac_cs_version="\\
3920-
RcppArmadillo config.status 15.2.1-0
3920+
RcppArmadillo config.status 15.2.2-0
39213921
configured by $0, generated by GNU Autoconf 2.72,
39223922
with options \\"\$ac_cs_config\\"
39233923

configure.ac

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
AC_PREREQ([2.69])
1212

1313
## Process this file with autoconf to produce a configure script.
14-
AC_INIT([RcppArmadillo],[15.2.1-0],[[email protected]])
14+
AC_INIT([RcppArmadillo],[15.2.2-0],[[email protected]])
1515

1616
## Set R_HOME, respecting an environment variable if one is set
1717
: ${R_HOME=$(R RHOME)}

inst/NEWS.Rd

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,19 @@
33
\newcommand{\ghpr}{\href{https://github.com/RcppCore/RcppArmadillo/pull/#1}{##1}}
44
\newcommand{\ghit}{\href{https://github.com/RcppCore/RcppArmadillo/issues/#1}{##1}}
55

6+
\section{Changes in RcppArmadillo version 15.2.2-0 (2025-11-20) (GitHub Only)}{
7+
\itemize{
8+
\item Upgraded to Armadillo release 15.2.2 (Medium Roast Deluxe)
9+
\itemize{
10+
\item Improved reproducibility of random number generation when using OpenMP
11+
}
12+
\item Skip a unit test file under macOS as complex algebra seems to fail
13+
under newer macOS LAPACK setting
14+
\item Further OpenMP detection rework for macOS
15+
\item Define ARMA_CRIPPLED_LAPACK on Windows only if 'LEGACY' Armadillo selected
16+
}
17+
}
18+
619
\section{Changes in RcppArmadillo version 15.2.1-0 (2025-10-28) (GitHub Only)}{
720
\itemize{
821
\item Upgraded to Armadillo release 15.2.1 (Medium Roast Deluxe)

inst/include/current/armadillo_bits/arma_rng.hpp

Lines changed: 73 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@
2626
#undef ARMA_USE_THREAD_LOCAL
2727
#define ARMA_USE_THREAD_LOCAL
2828

29+
#undef ARMA_USE_THREAD_UNIQUE_RNG_SEED
30+
#define ARMA_USE_THREAD_UNIQUE_RNG_SEED
31+
2932
#if (defined(ARMA_RNG_ALT) || defined(ARMA_DONT_USE_CXX11_RNG))
3033
#undef ARMA_USE_CXX11_RNG
3134
#endif
@@ -34,6 +37,10 @@
3437
#undef ARMA_USE_THREAD_LOCAL
3538
#endif
3639

40+
#if defined(ARMA_DONT_USE_THREAD_UNIQUE_RNG_SEED)
41+
#undef ARMA_USE_THREAD_UNIQUE_RNG_SEED
42+
#endif
43+
3744

3845
// NOTE: ARMA_WARMUP_PRODUCER enables a workaround
3946
// NOTE: for thread_local issue on macOS 11 and/or AppleClang 12.0
@@ -129,24 +136,42 @@ arma_rng::get_producer()
129136
{
130137
#if defined(ARMA_USE_THREAD_LOCAL)
131138

132-
// use a thread-safe RNG, with each thread having its own unique starting seed
133-
134-
static std::atomic<std::size_t> mt19937_64_producer_counter(0);
135-
136-
static thread_local std::mt19937_64 mt19937_64_producer( std::mt19937_64::default_seed + mt19937_64_producer_counter++ );
139+
// thread-safe RNG
137140

138-
arma_rng::warmup_producer(mt19937_64_producer);
141+
#if defined(ARMA_USE_THREAD_UNIQUE_RNG_SEED)
142+
143+
// each thread has unique starting seed
144+
145+
#if defined(ARMA_USE_OPENMP)
146+
147+
static thread_local std::mt19937_64 mt19937_64_producer( std::mt19937_64::default_seed + arma_rng::seed_type(omp_get_thread_num()) );
148+
149+
#else
150+
151+
static std::atomic<std::size_t> mt19937_64_producer_counter(0);
152+
153+
static thread_local std::mt19937_64 mt19937_64_producer( std::mt19937_64::default_seed + mt19937_64_producer_counter++ );
154+
155+
#endif
156+
157+
#else
158+
159+
// each thread has the same starting seed
160+
161+
static thread_local std::mt19937_64 mt19937_64_producer( std::mt19937_64::default_seed );
162+
163+
#endif
139164

140165
#else
141166

142-
// use a plain RNG in case we don't have thread_local
167+
// plain RNG in case we don't have thread_local
143168

144169
static std::mt19937_64 mt19937_64_producer( std::mt19937_64::default_seed );
145170

146-
arma_rng::warmup_producer(mt19937_64_producer);
147-
148171
#endif
149172

173+
arma_rng::warmup_producer(mt19937_64_producer);
174+
150175
return mt19937_64_producer;
151176
}
152177

@@ -226,9 +251,45 @@ arma_rng::set_seed(const arma_rng::seed_type val)
226251
}
227252
#elif defined(ARMA_USE_CXX11_RNG)
228253
{
229-
arma_rng::lock_producer();
230-
arma_rng::get_producer().seed(val);
231-
arma_rng::unlock_producer();
254+
#if defined(ARMA_USE_OPENMP) && defined(ARMA_USE_THREAD_LOCAL)
255+
{
256+
arma_rng::lock_producer();
257+
258+
#if defined(ARMA_USE_THREAD_UNIQUE_RNG_SEED)
259+
constexpr bool thread_unique_rng_seed = true;
260+
#else
261+
constexpr bool thread_unique_rng_seed = false;
262+
#endif
263+
264+
// if we're already in a parallel region, assume the user is setting the seed for each thread
265+
266+
if( (thread_unique_rng_seed == false) || bool(omp_in_parallel()) )
267+
{
268+
arma_rng::get_producer().seed(val);
269+
}
270+
else
271+
{
272+
const int n_threads = int( (std::max)( int(1), int(omp_get_max_threads()) ) );
273+
274+
#pragma omp parallel for ordered schedule(static) num_threads(n_threads)
275+
for(int t=0; t < n_threads; ++t)
276+
{
277+
#pragma omp ordered
278+
{
279+
arma_rng::get_producer().seed(val + arma_rng::seed_type(omp_get_thread_num()));
280+
}
281+
}
282+
}
283+
284+
arma_rng::unlock_producer();
285+
}
286+
#else
287+
{
288+
arma_rng::lock_producer();
289+
arma_rng::get_producer().seed(val);
290+
arma_rng::unlock_producer();
291+
}
292+
#endif
232293
}
233294
#else
234295
{

inst/include/current/armadillo_bits/arma_version.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323

2424
#define ARMA_VERSION_MAJOR 15
2525
#define ARMA_VERSION_MINOR 2
26-
#define ARMA_VERSION_PATCH 1
26+
#define ARMA_VERSION_PATCH 2
2727
#define ARMA_VERSION_NAME "Medium Roast Deluxe"
2828

2929

inst/tinytest/test_Rlapack.R

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@
2020

2121
library(RcppArmadillo)
2222

23+
if (Sys.info()['sysname'] == "Darwin") exit_file("Skip on macOS")
24+
2325
if (isFALSE(tryCatch({svd(matrix(complex(1, 1, 1),1,1)); TRUE}, error=function(e) FALSE)))
2426
exit_file("Skipping for lack of Fortran complex functions in this R build")
2527

0 commit comments

Comments
 (0)