Skip to content

Commit 27cbb93

Browse files
authored
Merge pull request #394 from RcppCore/feature/armadillo_11.4.1
RcppArmadillo 0.11.4.1.0 with Armadillo 11.4.1
2 parents ba637a6 + 5679a58 commit 27cbb93

File tree

9 files changed

+180
-95
lines changed

9 files changed

+180
-95
lines changed

ChangeLog

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
2022-10-10 Dirk Eddelbuettel <[email protected]>
2+
3+
* DESCRIPTION (Version): RcppArmadillo 0.11.4.1.0
4+
* inst/NEWS.Rd: Idem
5+
* configure.ac: Idem
6+
* configure: Idem
7+
18
2022-10-01 Dirk Eddelbuettel <[email protected]>
29

310
* DESCRIPTION (Version): RcppArmadillo 0.11.4.0.1

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: 0.11.4.0.1
5-
Date: 2022-10-01
4+
Version: 0.11.4.1.0
5+
Date: 2022-10-10
66
Author: Dirk Eddelbuettel, Romain Francois, Doug Bates, Binxiang Ni, and Conrad Sanderson
77
Maintainer: Dirk Eddelbuettel <[email protected]>
88
Description: 'Armadillo' is a templated C++ linear algebra library (by Conrad

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.71 for RcppArmadillo 0.11.4.0.1.
3+
# Generated by GNU Autoconf 2.71 for RcppArmadillo 0.11.4.1.0.
44
#
55
# Report bugs to <[email protected]>.
66
#
@@ -610,8 +610,8 @@ MAKEFLAGS=
610610
# Identity of this package.
611611
PACKAGE_NAME='RcppArmadillo'
612612
PACKAGE_TARNAME='rcpparmadillo'
613-
PACKAGE_VERSION='0.11.4.0.1'
614-
PACKAGE_STRING='RcppArmadillo 0.11.4.0.1'
613+
PACKAGE_VERSION='0.11.4.1.0'
614+
PACKAGE_STRING='RcppArmadillo 0.11.4.1.0'
615615
PACKAGE_BUGREPORT='[email protected]'
616616
PACKAGE_URL=''
617617

@@ -1229,7 +1229,7 @@ if test "$ac_init_help" = "long"; then
12291229
# Omit some internal or obsolete options to make the list less imposing.
12301230
# This message is too long to be a string in the A/UX 3.1 sh.
12311231
cat <<_ACEOF
1232-
\`configure' configures RcppArmadillo 0.11.4.0.1 to adapt to many kinds of systems.
1232+
\`configure' configures RcppArmadillo 0.11.4.1.0 to adapt to many kinds of systems.
12331233
12341234
Usage: $0 [OPTION]... [VAR=VALUE]...
12351235
@@ -1291,7 +1291,7 @@ fi
12911291

12921292
if test -n "$ac_init_help"; then
12931293
case $ac_init_help in
1294-
short | recursive ) echo "Configuration of RcppArmadillo 0.11.4.0.1:";;
1294+
short | recursive ) echo "Configuration of RcppArmadillo 0.11.4.1.0:";;
12951295
esac
12961296
cat <<\_ACEOF
12971297
@@ -1372,7 +1372,7 @@ fi
13721372
test -n "$ac_init_help" && exit $ac_status
13731373
if $ac_init_version; then
13741374
cat <<\_ACEOF
1375-
RcppArmadillo configure 0.11.4.0.1
1375+
RcppArmadillo configure 0.11.4.1.0
13761376
generated by GNU Autoconf 2.71
13771377
13781378
Copyright (C) 2021 Free Software Foundation, Inc.
@@ -1486,7 +1486,7 @@ cat >config.log <<_ACEOF
14861486
This file contains any messages produced by compilers while
14871487
running configure, to aid debugging if configure makes a mistake.
14881488
1489-
It was created by RcppArmadillo $as_me 0.11.4.0.1, which was
1489+
It was created by RcppArmadillo $as_me 0.11.4.1.0, which was
14901490
generated by GNU Autoconf 2.71. Invocation command line was
14911491
14921492
$ $0$ac_configure_args_raw
@@ -3944,7 +3944,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
39443944
# report actual input values of CONFIG_FILES etc. instead of their
39453945
# values after options handling.
39463946
ac_log="
3947-
This file was extended by RcppArmadillo $as_me 0.11.4.0.1, which was
3947+
This file was extended by RcppArmadillo $as_me 0.11.4.1.0, which was
39483948
generated by GNU Autoconf 2.71. Invocation command line was
39493949
39503950
CONFIG_FILES = $CONFIG_FILES
@@ -3999,7 +3999,7 @@ ac_cs_config_escaped=`printf "%s\n" "$ac_cs_config" | sed "s/^ //; s/'/'\\\\\\\\
39993999
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
40004000
ac_cs_config='$ac_cs_config_escaped'
40014001
ac_cs_version="\\
4002-
RcppArmadillo config.status 0.11.4.0.1
4002+
RcppArmadillo config.status 0.11.4.1.0
40034003
configured by $0, generated by GNU Autoconf 2.71,
40044004
with options \\"\$ac_cs_config\\"
40054005

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],[0.11.4.0.1],[[email protected]])
14+
AC_INIT([RcppArmadillo],[0.11.4.1.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: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,18 @@
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 0.11.4.1.0 (2022-10-10) (GitHub Only)}{
7+
\itemize{
8+
\item Upgraded to Armadillo release 11.4.1 (Ship of Theseus)
9+
\itemize{
10+
\item fix data race in \code{Cube::slice()}
11+
\item workarounds for false warnings emitted by GCC 12 when
12+
compiling with \code{FORTIFY_SOURCE} enabled (already in
13+
RcppArmadillo 0.11.4.0.1 too)
14+
}
15+
}
16+
}
17+
618
\section{Changes in RcppArmadillo version 0.11.4.0.1 (2022-10-01)}{
719
\itemize{
820
\item Upgraded to Armadillo release 11.4.0 (Ship of Theseus)

inst/include/armadillo_bits/Cube_bones.hpp

Lines changed: 33 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -39,13 +39,13 @@ class Cube : public BaseCube< eT, Cube<eT> >
3939
typedef eT elem_type; //!< the type of elements stored in the cube
4040
typedef typename get_pod_type<eT>::result pod_type; //!< if eT is std::complex<T>, pod_type is T; otherwise pod_type is eT
4141

42-
const uword n_rows; //!< number of rows in each slice (read-only)
43-
const uword n_cols; //!< number of columns in each slice (read-only)
44-
const uword n_elem_slice; //!< number of elements in each slice (read-only)
45-
const uword n_slices; //!< number of slices in the cube (read-only)
46-
const uword n_elem; //!< number of elements in the cube (read-only)
47-
const uword n_alloc; //!< number of allocated elements (read-only); NOTE: n_alloc can be 0, even if n_elem > 0
48-
const uword mem_state;
42+
const uword n_rows; //!< number of rows in each slice (read-only)
43+
const uword n_cols; //!< number of columns in each slice (read-only)
44+
const uword n_elem_slice; //!< number of elements in each slice (read-only)
45+
const uword n_slices; //!< number of slices in the cube (read-only)
46+
const uword n_elem; //!< number of elements in the cube (read-only)
47+
const uword n_alloc; //!< number of allocated elements (read-only); NOTE: n_alloc can be 0, even if n_elem > 0
48+
const uword mem_state;
4949

5050
// mem_state = 0: normal cube which manages its own memory
5151
// mem_state = 1: use auxiliary memory until a size change
@@ -57,10 +57,27 @@ class Cube : public BaseCube< eT, Cube<eT> >
5757

5858
protected:
5959

60-
arma_aligned const Mat<eT>** const mat_ptrs;
60+
using mat_type = Mat<eT>;
61+
62+
#if defined(ARMA_USE_OPENMP)
63+
using raw_mat_ptr_type = mat_type*;
64+
using atomic_mat_ptr_type = mat_type*;
65+
#elif (!defined(ARMA_DONT_USE_STD_MUTEX))
66+
using raw_mat_ptr_type = mat_type*;
67+
using atomic_mat_ptr_type = std::atomic<mat_type*>;
68+
#else
69+
using raw_mat_ptr_type = mat_type*;
70+
using atomic_mat_ptr_type = mat_type*;
71+
#endif
72+
73+
atomic_mat_ptr_type* mat_ptrs = nullptr;
74+
75+
#if (!defined(ARMA_DONT_USE_STD_MUTEX))
76+
mutable std::mutex mat_mutex; // required for slice()
77+
#endif
6178

62-
arma_align_mem Mat<eT>* mat_ptrs_local[ Cube_prealloc::mat_ptrs_size ];
63-
arma_align_mem eT mem_local[ Cube_prealloc::mem_n_elem ]; // local storage, for small cubes
79+
arma_aligned atomic_mat_ptr_type mat_ptrs_local[ Cube_prealloc::mat_ptrs_size ];
80+
arma_align_mem eT mem_local[ Cube_prealloc::mem_n_elem ]; // local storage, for small cubes
6481

6582

6683
public:
@@ -124,7 +141,7 @@ class Cube : public BaseCube< eT, Cube<eT> >
124141

125142
inline Mat<eT>& slice(const uword in_slice);
126143
inline const Mat<eT>& slice(const uword in_slice) const;
127-
144+
128145
arma_inline subview_cube<eT> rows(const uword in_row1, const uword in_row2);
129146
arma_inline const subview_cube<eT> rows(const uword in_row1, const uword in_row2) const;
130147

@@ -445,6 +462,9 @@ class Cube : public BaseCube< eT, Cube<eT> >
445462
inline void delete_mat();
446463
inline void create_mat();
447464

465+
inline void create_mat_ptr(const uword in_slice) const;
466+
inline Mat<eT>* get_mat_ptr(const uword in_slice) const;
467+
448468
friend class glue_join;
449469
friend class op_reshape;
450470
friend class op_resize;
@@ -471,8 +491,8 @@ class Cube<eT>::fixed : public Cube<eT>
471491

472492
static constexpr bool use_extra = (fixed_n_elem > Cube_prealloc::mem_n_elem);
473493

474-
arma_aligned Mat<eT>* mat_ptrs_local_extra[ (fixed_n_slices > Cube_prealloc::mat_ptrs_size) ? fixed_n_slices : 1 ];
475-
arma_align_mem eT mem_local_extra [ use_extra ? fixed_n_elem : 1 ];
494+
arma_aligned atomic_mat_ptr_type mat_ptrs_local_extra[ (fixed_n_slices > Cube_prealloc::mat_ptrs_size) ? fixed_n_slices : 1 ];
495+
arma_align_mem eT mem_local_extra[ use_extra ? fixed_n_elem : 1 ];
476496

477497
arma_inline void mem_setup();
478498

0 commit comments

Comments
 (0)