Re: [eigen] runtime API to configure the cache/blocking parameters |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/eigen Archives
]
- To: eigen@xxxxxxxxxxxxxxxxxxx
- Subject: Re: [eigen] runtime API to configure the cache/blocking parameters
- From: Benoit Jacob <jacob.benoit.1@xxxxxxxxx>
- Date: Mon, 7 Jun 2010 11:28:57 -0400
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:received:in-reply-to :references:date:message-id:subject:from:to:content-type :content-transfer-encoding; bh=Z5Y8ZlVpx6+5/OmQyxmtr4Q/2wT36h7Y7/uUblTGmIs=; b=TR66gI+hHUFVF7oUtZ9/UOyOR7vh22FdkNKsYxL/d3NpE+1aksjIiYk125jBAmJH0q J6OlSiGTbLIU3p09AeoWjNvJKTY7xUmzcCQmeWm4RTuFaRBBYSLVKE3bUbKydfFNHorM xILWi4Z8mE2aLkm6M+dRefxpJGVwz2nf1RpGo=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; b=N0fHlTVoGH6NDa896SezC+da8zTS1ThowbOlQb73shmmhl0OosdALGnY77hzQbBsNb 8i7z6/bTOehq52JWoM7Xo5EB+7bWX+35X5iW+XTKG5730HWs/LAS/5YgRJ5CV1U4dWFz jSZboVpfvgz3YGs/BQ4OyelsXaeofrDGyB8Xo=
Great!
Just one nit: why ei_ ? This is public API, and doesn't conflict with
a std:: name, so I don't think it should be ei_ prefixed.
Can you quickly explain me what the maxK and maxM are ?
Thanks,
Benoit
2010/6/7 Gael Guennebaud <gael.guennebaud@xxxxxxxxx>:
> Hi,
>
> I've committed a change allowing to configure the cache size and the related
> blocking size parameters at runtime. It use the trick that consists in
> storing runtime variables as static members of a global function. This way
> no need to have a shared binary lib just for that.
>
> Here is the related "public" documented API:
>
> /** \returns the currently set cpu cache size (in bytes) used to estimate
> the ideal blocking size parameters */
> std::ptrdiff_t ei_cpuCacheSize();
>
> /** Set the cpu cache size (in bytes) for blocking.
> * This function also automatically set the blocking size parameters for
> each scalar type using the following formula:
> * \code
> * max_k = 4 * sqrt(cache_size/(64*sizeof(Scalar)));
> * max_m = 2 * k;
> * \endcode
> * overwriting custom values set using the ei_setBlockingSizes function.
> * \sa ei_setBlockingSizes */
> void ei_setCpuCacheSize(std::ptrdiff_t cache_size);
>
> /** Set the blocking size parameters \a maxK and \a maxM for the scalar type
> \a Scalar.
> * Note that in practice there is no distinction between scalar types of
> same size.
> * \sa ei_setCpuCacheSize */
> template<typename Scalar>
> void ei_setBlockingSizes(std::ptrdiff_t maxK, std::ptrdiff_t maxM);
>
> /** \returns in \a makK, \a maxM the blocking size parameters for the scalar
> type \a Scalar.
> * \sa ei_setBlockingSizes */
> template<typename Scalar>
> void ei_getBlockingSizes(std::ptrdiff_t& maxK, std::ptrdiff_t& maxM);
>
> You can also see the complete diff there:
> http://bitbucket.org/eigen/eigen/changeset/af6d26ce2778 to see how it is
> implemented in practice.
>
> This API is just a proposal, if someone has better ideas...
>
> gael
>