Re: [eigen] Parallel matrix multiplication causes heap allocation |

[ Thread Index | Date Index | More lists.tuxfamily.org/eigen Archives ]

*To*: eigen <eigen@xxxxxxxxxxxxxxxxxxx>*Subject*: Re: [eigen] Parallel matrix multiplication causes heap allocation*From*: Gael Guennebaud <gael.guennebaud@xxxxxxxxx>*Date*: Sun, 18 Dec 2016 18:12:49 +0100*Dkim-signature*: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to; bh=bzL4XQh2ddcgcbnpeKtaa5DbKms8gx5ovcLtwBS/3I8=; b=cAI09XL5ntqn1D4O6DFlPOVK7pVxDwc0fYmRo/Kbwq/QcgyRYvbfGCMxZQAUIzmvHq 8aKVLrJ292CjS/nyA1rQQADff+cjsZeOV4NHXqAF0jqllI3u+4kGzwykZNt31+9kabZh gOCF6RTDZo0eIZ2Ln3Ti3vBJPwEQ5DWZjUBrum0WPWA6WCsOhiq3ihUN6KWOPF5IddcU QegvctxWtNVdxtOn7DfUSHMsbQ4TEKRc+MT3oWZbFZnZDTPd/YPPkYcnWhk3TMiAJqi1 hu4+dD9Dw6qZgqP3xPY9PQEMh2rGU7dyA3uNgBx0+QnQ/8iKNLAF/4TXSghwXP5aUFRR 2pKA==

On Sun, Dec 18, 2016 at 7:28 AM, François Fayard <fayard@xxxxxxxxxxxxx> wrote:

Hi Rene,I have skimed recently through the matrix multiplication code. In order to be cache friendly, Eigen performs many smaller matrix multiplication and it turns out that those smaller matrices are copied and rearranged in memory to speed up the multiplication process. So malloc is expected to happen in matrix multiplication.

yes I confirm.

As far as I know, other blas libraries such as OpenBLAS don't perform such copies. Is there any way to get rid of them in eigen?

nope, OpenBLAS does the same, and I believe MKL does too. I'm convinced that for large enough matrices it is impossible to reach such high performance without those copies/repacking.

gael

FrançoisDear Eigen team,

first of all, thank you for all your effort to create such a great math library. I really love using it.

I’ve got a question about your parallelization routines. I want to calculate a parallel (omp based) matrix multiplication (result: 500 x 250 matrix) without allocating any new space in the meantime. So I have activated „Eigen::internal::set_is_malloc_allowed(false)“ to check that nothing goes wrong. However, my program crashes with the error message „Assertion failed: (is_malloc_allowed() && "heap allocation is forbidden (EIGEN_RUNTIME_NO_MALLOC is defined and g_is_malloc_allowed is false)"), function check_that_malloc_is_allowed, file /Users/xxx//libs/eigen/Eigen/. Is this behaviour desired? Should there be an allocation before doing parallel calculations? Or am I doing something wrong?src/Core/util/Memory.h, line 143.“

Thanks in advance.

Regards,

René AhlsdorfEigen Version: 3.3.1 (commit f562a193118d)Attached: Screenshot showing the last function calls<Screenshot 2016-12-18 01.01.42.png>

**Follow-Ups**:**Re: [eigen] Parallel matrix multiplication causes heap allocation***From:*Francois Fayard

**Re: [eigen] Parallel matrix multiplication causes heap allocation***From:*Jeff Hammond

**References**:**[eigen] Parallel matrix multiplication causes heap allocation***From:*Rene Ahlsdorf

**Re: [eigen] Parallel matrix multiplication causes heap allocation***From:*François Fayard

**Messages sorted by:**[ date | thread ]- Prev by Date:
**Re: [eigen] Parallel matrix multiplication causes heap allocation** - Next by Date:
**Re: [eigen] Parallel matrix multiplication causes heap allocation** - Previous by thread:
**Re: [eigen] Parallel matrix multiplication causes heap allocation** - Next by thread:
**Re: [eigen] Parallel matrix multiplication causes heap allocation**

Mail converted by MHonArc 2.6.19+ | http://listengine.tuxfamily.org/ |