Skip to content

Commit b216f85

Browse files
committed
Armadillo 12.8.3
1 parent af50cb4 commit b216f85

File tree

5 files changed

+41
-9
lines changed

5 files changed

+41
-9
lines changed

inst/include/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 12
2525
#define ARMA_VERSION_MINOR 8
26-
#define ARMA_VERSION_PATCH 2
26+
#define ARMA_VERSION_PATCH 3
2727
#define ARMA_VERSION_NAME "Cortisol Injector"
2828

2929

inst/include/armadillo_bits/compiler_setup.hpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -377,14 +377,11 @@
377377

378378

379379
#if defined(__SUNPRO_CC)
380-
381380
// http://www.oracle.com/technetwork/server-storage/solarisstudio/training/index-jsp-141991.html
382381
// http://www.oracle.com/technetwork/server-storage/solarisstudio/documentation/cplusplus-faq-355066.html
383-
384382
#if (__SUNPRO_CC < 0x5140)
385383
#error "*** newer compiler required ***"
386384
#endif
387-
388385
#endif
389386

390387

inst/include/armadillo_bits/config.hpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,11 @@
201201

202202
#if defined(ARMA_EXTRA_DEBUG)
203203
#undef ARMA_NO_DEBUG
204+
#undef ARMA_DONT_CHECK_NONFINITE
205+
206+
#undef ARMA_CHECK_NONFINITE
207+
#define ARMA_CHECK_NONFINITE
208+
204209
#undef ARMA_WARN_LEVEL
205210
#define ARMA_WARN_LEVEL 3
206211
#endif

inst/include/armadillo_bits/debug.hpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -579,7 +579,7 @@ arma_assert_same_size(const uword A_n_rows, const uword A_n_cols, const uword B_
579579

580580

581581

582-
//! stop if given matrices have different sizes
582+
//! stop if given matrices do not have the same size
583583
template<typename eT1, typename eT2>
584584
arma_hot
585585
inline
@@ -600,7 +600,7 @@ arma_assert_same_size(const Mat<eT1>& A, const Mat<eT2>& B, const char* x)
600600

601601

602602

603-
//! stop if given proxies have different sizes
603+
//! stop if given proxies do not have the same size
604604
template<typename eT1, typename eT2>
605605
arma_hot
606606
inline
@@ -804,7 +804,7 @@ arma_assert_same_size(const uword A_n_rows, const uword A_n_cols, const uword A_
804804

805805

806806

807-
//! stop if given cubes have different sizes
807+
//! stop if given cubes do not have the same size
808808
template<typename eT1, typename eT2>
809809
arma_hot
810810
inline
@@ -883,7 +883,7 @@ arma_assert_same_size(const subview_cube<eT>& A, const ProxyCube<T1>& B, const c
883883

884884

885885

886-
//! stop if given cube proxies have different sizes
886+
//! stop if given cube proxies do not have the same size
887887
template<typename eT1, typename eT2>
888888
arma_hot
889889
inline

inst/include/armadillo_bits/fft_engine_fftw3.hpp

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,13 @@
2323

2424
#if defined(ARMA_USE_FFTW3)
2525

26+
struct fft_engine_fftw3_aux
27+
{
28+
#if (!defined(ARMA_DONT_USE_STD_MUTEX))
29+
static inline std::mutex& get_plan_mutex() { static std::mutex plan_mutex; return plan_mutex; }
30+
#endif
31+
};
32+
2633
template<typename cx_type, bool inverse>
2734
class fft_engine_fftw3
2835
{
@@ -74,7 +81,30 @@ class fft_engine_fftw3
7481
const int fftw3_flags = fftw3_flag_destroy | fftw3_flag_estimate;
7582

7683
arma_extra_debug_print("fft_engine_fftw3::constructor: generating 1D plan");
77-
fftw3_plan = fftw3::plan_dft_1d<cx_type>(N, X_work.memptr(), Y_work.memptr(), fftw3_sign, fftw3_flags);
84+
85+
// only fftw3::execute() is thread safe, as per FFTW docs:
86+
// https://www.fftw.org/fftw3_doc/Thread-safety.html
87+
88+
#if defined(ARMA_USE_OPENMP)
89+
{
90+
#pragma omp critical (arma_fft_engine_fftw3)
91+
{
92+
fftw3_plan = fftw3::plan_dft_1d<cx_type>(N, X_work.memptr(), Y_work.memptr(), fftw3_sign, fftw3_flags);
93+
}
94+
}
95+
#elif (!defined(ARMA_DONT_USE_STD_MUTEX))
96+
{
97+
std::mutex& plan_mutex = fft_engine_fftw3_aux::get_plan_mutex();
98+
99+
const std::lock_guard<std::mutex> lock(plan_mutex);
100+
101+
fftw3_plan = fftw3::plan_dft_1d<cx_type>(N, X_work.memptr(), Y_work.memptr(), fftw3_sign, fftw3_flags);
102+
}
103+
#else
104+
{
105+
fftw3_plan = fftw3::plan_dft_1d<cx_type>(N, X_work.memptr(), Y_work.memptr(), fftw3_sign, fftw3_flags);
106+
}
107+
#endif
78108

79109
if(fftw3_plan == nullptr) { arma_stop_runtime_error("fft_engine_fftw3::constructor: failed to create plan"); }
80110
}

0 commit comments

Comments
 (0)