mirror of
https://gitlab.com/libeigen/eigen.git
synced 2026-04-10 11:34:33 +08:00
Enable equality comparisons on GPU.
Since `std::equal_to::operator()` is not a device function, it
fails on GPU. On my device, I seem to get a silent crash in the
kernel (no reported error, but the kernel does not complete).
Replacing this with a portable version enables comparisons on device.
Addresses #2292 - would need to be cherry-picked. The 3.3 branch
also requires adding `EIGEN_DEVICE_FUNC` in `BooleanRedux.h` to get
fully working.
(cherry picked from commit 7880f10526)
This commit is contained in:
committed by
Rasmus Munk Larsen
parent
7adc1545b4
commit
3dc42eeaec
@@ -197,18 +197,17 @@ struct complex_operators {
|
||||
res.segment(block_idx, size) = x1; res.segment(block_idx, size).array() /= x2.array();
|
||||
block_idx += size;
|
||||
|
||||
// Equality comparisons currently not functional on device
|
||||
// (std::equal_to<T> is host-only).
|
||||
// const T true_vector = T::Constant(true_value);
|
||||
// const T false_vector = T::Constant(false_value);
|
||||
// res.segment(block_idx, size) = (x1 == x2 ? true_vector : false_vector);
|
||||
// block_idx += size;
|
||||
const T true_vector = T::Constant(true_value);
|
||||
const T false_vector = T::Constant(false_value);
|
||||
res.segment(block_idx, size) = (x1 == x2 ? true_vector : false_vector);
|
||||
block_idx += size;
|
||||
// Mixing types in equality comparison does not work.
|
||||
// res.segment(block_idx, size) = (x1 == x2.real() ? true_vector : false_vector);
|
||||
// block_idx += size;
|
||||
// res.segment(block_idx, size) = (x1.real() == x2 ? true_vector : false_vector);
|
||||
// block_idx += size;
|
||||
// res.segment(block_idx, size) = (x1 != x2 ? true_vector : false_vector);
|
||||
// block_idx += size;
|
||||
res.segment(block_idx, size) = (x1 != x2 ? true_vector : false_vector);
|
||||
block_idx += size;
|
||||
// res.segment(block_idx, size) = (x1 != x2.real() ? true_vector : false_vector);
|
||||
// block_idx += size;
|
||||
// res.segment(block_idx, size) = (x1.real() != x2 ? true_vector : false_vector);
|
||||
|
||||
Reference in New Issue
Block a user