On Wed, Aug 17, 2016 at 1:31 PM, Páll Haraldsson <pall.haralds...@gmail.com> wrote:
> On Tuesday, August 16, 2016 at 1:41:54 PM UTC, Erik Schnetter wrote: >> >> ```Julia >> Pkg.add("Hwloc") >> using Hwloc >> topo = load_topology() >> print(topo) >> ``` >> >> I just see that Hwloc has problems with Julia 0.5; I'll tag a new release. >> > > Great to know about the hwloc package and its wrapper (I was going to post > some links on dynamically finding out.. or statically for Linux) . > > I did notice however: > > "Remove non-functional Windows support > <https://github.com/JuliaParallel/Hwloc.jl/commit/5cc4f3c3bd20237f82a6ad300b5df94c8d2798b5>" > (just in the wrapper, the base library supports Windows, so you could add > suport.. and that commit helps knowing how). > > [I didn't check FreeBSD (or OS X) support, is it compatible with Linux?] > Yes, it works on all Unix systems I tried. The code to determine the L1 cache size is the same on Windows as on Unix. The problem is just that I don't know how to build the hwloc library on Windows, or how to install a pre-built one. This is not a difficult problem, I just didn't have a need for this. I was looking into this myself a while back (and getting cache-line size). > I guess a default fallback of at least 4 KB, possibly 32 KB, might be ok > (and 16-byte cache lines, probably save and lowest/most common size) on > case your library finds nothing, e.g. on Windows. [BLAS is compiled, I > think with cache knowledge, maybe there's a way of knowing dynamically with > what options? I guess not good to rely on, think it's stipped out in > Julia-lite branch.] > Current (and many former) Intel CPUs use an L1 data cache size with 32 kByte, with cache lines of 64 Bytes. Depending on your application, it is safer to over-estimate the cache line size, for example if you need to prevent accessing the same cache line from multiple threads. -erik [I was also thinking ahead to AOT compiled Julia.. be aware of that also.. > when cross-compiling Julia and C++ would seem to have to be conservative, > one reason Julia seems better than C++ (even without AOT).] > > > See here for save lowest-L1 size you want to support (I've never heard of > lower than 4 KB data, all shared code+data gone and also where 4 KB): > > https://en.wikipedia.org/wiki/List_of_ARM_microarchitectures > > > >is there a (cross-platform) way to get the CPU L1 cache size > > You assume you have a [L1] cache..? :) My/the first ARM had none.. than > came 4 KB (shared, later split and more than L1). Yes, all computers in > decades have a cache, except for newest fastest TOP500 supercomputer > (scratchpad, Adapteva's CPU similar) and Tera had just many threads.. > > -- > Palli. > > > >> >> -erik >> >> >> On Tue, Aug 16, 2016 at 5:12 AM, Oliver Schulz <oliver...@tu-dortmund.de> >> wrote: >> >>> Hi, >>> >>> is there a (cross-platform) way to get the CPU L1 cache size from Julia? >>> I'd like to determine the optimal block size(s) for an array algorithm. >>> >>> >>> Cheers, >>> >>> Oliver >>> >>> >> >> >> -- >> Erik Schnetter <schn...@gmail.com> http://www.perimeterinstitute. >> ca/personal/eschnetter/ >> > -- Erik Schnetter <schnet...@gmail.com> http://www.perimeterinstitute.ca/personal/eschnetter/