JuliaDataCubes / YAXArrays.jl

Yet Another XArray-like Julia package
https://juliadatacubes.github.io/YAXArrays.jl/
Other
99 stars 16 forks source link

Use views to avoid thread issues #287

Closed meggart closed 8 months ago

meggart commented 1 year ago

@felixcremer as discussed this branch would use views instead of pre-allocated buffer arrays and can therefore be used in the multithreaded loop without :static. Could you test if this would speed up your c-scale runs?

github-actions[bot] commented 1 year ago
Benchmark result # Judge result # Benchmark Report for */home/runner/work/YAXArrays.jl/YAXArrays.jl* ## Job Properties * Time of benchmarks: - Target: 7 Jul 2023 - 07:31 - Baseline: 7 Jul 2023 - 07:31 * Package commits: - Target: d82bf7 - Baseline: a83aef * Julia commits: - Target: e4ee48 - Baseline: e4ee48 * Julia command flags: - Target: None - Baseline: None * Environment variables: - Target: None - Baseline: None ## Results A ratio greater than `1.0` denotes a possible regression (marked with :x:), while a ratio less than `1.0` denotes a possible improvement (marked with :white_check_mark:). Only significant results - results that indicate possible regressions or improvements - are shown below (thus, an empty table means that all benchmark results remained invariant between builds). | ID | time ratio | memory ratio | |--------------------------|------------------------------|------------------------------| | `["mapslices", "small"]` | 0.02 (5%) :white_check_mark: | 0.23 (1%) :white_check_mark: | ## Benchmark Group List Here's a list of all the benchmark groups executed by this job: - `["mapslices"]` ## Julia versioninfo ### Target ``` Julia Version 1.9.2 Commit e4ee485e909 (2023-07-05 09:39 UTC) Platform Info: OS: Linux (x86_64-linux-gnu) Ubuntu 22.04.2 LTS uname: Linux 5.15.0-1041-azure #48-Ubuntu SMP Tue Jun 20 20:34:08 UTC 2023 x86_64 x86_64 CPU: Intel(R) Xeon(R) Platinum 8272CL CPU @ 2.60GHz: speed user nice sys idle irq #1 2593 MHz 1273 s 0 s 168 s 1569 s 0 s #2 2593 MHz 1200 s 0 s 211 s 1579 s 0 s Memory: 6.7694854736328125 GB (5035.03515625 MB free) Uptime: 304.93 sec Load Avg: 1.68 0.99 0.42 WORD_SIZE: 64 LIBM: libopenlibm LLVM: libLLVM-14.0.6 (ORCJIT, skylake-avx512) Threads: 1 on 2 virtual cores ``` ### Baseline ``` Julia Version 1.9.2 Commit e4ee485e909 (2023-07-05 09:39 UTC) Platform Info: OS: Linux (x86_64-linux-gnu) Ubuntu 22.04.2 LTS uname: Linux 5.15.0-1041-azure #48-Ubuntu SMP Tue Jun 20 20:34:08 UTC 2023 x86_64 x86_64 CPU: Intel(R) Xeon(R) Platinum 8272CL CPU @ 2.60GHz: speed user nice sys idle irq #1 2593 MHz 1562 s 0 s 176 s 1635 s 0 s #2 2593 MHz 1270 s 0 s 214 s 1868 s 0 s Memory: 6.7694854736328125 GB (5086.66796875 MB free) Uptime: 341.3 sec Load Avg: 1.35 0.99 0.45 WORD_SIZE: 64 LIBM: libopenlibm LLVM: libLLVM-14.0.6 (ORCJIT, skylake-avx512) Threads: 1 on 2 virtual cores ``` --- # Target result # Benchmark Report for */home/runner/work/YAXArrays.jl/YAXArrays.jl* ## Job Properties * Time of benchmark: 7 Jul 2023 - 7:31 * Package commit: d82bf7 * Julia commit: e4ee48 * Julia command flags: None * Environment variables: None ## Results Below is a table of this job's results, obtained by running the benchmarks. The values listed in the `ID` column have the structure `[parent_group, child_group, ..., key]`, and can be used to index into the BaseBenchmarks suite to retrieve the corresponding benchmarks. The percentages accompanying time and memory values in the below table are noise tolerances. The "true" time/memory value for a given benchmark is expected to fall within this percentage of the reported value. An empty cell means that the value was zero. | ID | time | GC time | memory | allocations | |--------------------------|----------------:|-----------:|----------------:|------------:| | `["mapslices", "small"]` | 367.085 ms (5%) | 190.328 ms | 330.88 MiB (1%) | 101271 | ## Benchmark Group List Here's a list of all the benchmark groups executed by this job: - `["mapslices"]` ## Julia versioninfo ``` Julia Version 1.9.2 Commit e4ee485e909 (2023-07-05 09:39 UTC) Platform Info: OS: Linux (x86_64-linux-gnu) Ubuntu 22.04.2 LTS uname: Linux 5.15.0-1041-azure #48-Ubuntu SMP Tue Jun 20 20:34:08 UTC 2023 x86_64 x86_64 CPU: Intel(R) Xeon(R) Platinum 8272CL CPU @ 2.60GHz: speed user nice sys idle irq #1 2593 MHz 1273 s 0 s 168 s 1569 s 0 s #2 2593 MHz 1200 s 0 s 211 s 1579 s 0 s Memory: 6.7694854736328125 GB (5035.03515625 MB free) Uptime: 304.93 sec Load Avg: 1.68 0.99 0.42 WORD_SIZE: 64 LIBM: libopenlibm LLVM: libLLVM-14.0.6 (ORCJIT, skylake-avx512) Threads: 1 on 2 virtual cores ``` --- # Baseline result # Benchmark Report for */home/runner/work/YAXArrays.jl/YAXArrays.jl* ## Job Properties * Time of benchmark: 7 Jul 2023 - 7:31 * Package commit: a83aef * Julia commit: e4ee48 * Julia command flags: None * Environment variables: None ## Results Below is a table of this job's results, obtained by running the benchmarks. The values listed in the `ID` column have the structure `[parent_group, child_group, ..., key]`, and can be used to index into the BaseBenchmarks suite to retrieve the corresponding benchmarks. The percentages accompanying time and memory values in the below table are noise tolerances. The "true" time/memory value for a given benchmark is expected to fall within this percentage of the reported value. An empty cell means that the value was zero. | ID | time | GC time | memory | allocations | |--------------------------|--------------:|-----------:|--------------:|------------:| | `["mapslices", "small"]` | 14.792 s (5%) | 634.490 ms | 1.40 GiB (1%) | 19110572 | ## Benchmark Group List Here's a list of all the benchmark groups executed by this job: - `["mapslices"]` ## Julia versioninfo ``` Julia Version 1.9.2 Commit e4ee485e909 (2023-07-05 09:39 UTC) Platform Info: OS: Linux (x86_64-linux-gnu) Ubuntu 22.04.2 LTS uname: Linux 5.15.0-1041-azure #48-Ubuntu SMP Tue Jun 20 20:34:08 UTC 2023 x86_64 x86_64 CPU: Intel(R) Xeon(R) Platinum 8272CL CPU @ 2.60GHz: speed user nice sys idle irq #1 2593 MHz 1562 s 0 s 176 s 1635 s 0 s #2 2593 MHz 1270 s 0 s 214 s 1868 s 0 s Memory: 6.7694854736328125 GB (5086.66796875 MB free) Uptime: 341.3 sec Load Avg: 1.35 0.99 0.45 WORD_SIZE: 64 LIBM: libopenlibm LLVM: libLLVM-14.0.6 (ORCJIT, skylake-avx512) Threads: 1 on 2 virtual cores ``` --- # Runtime information | Runtime Info | | |:--|:--| | BLAS #threads | 1 | | `BLAS.vendor()` | `lbt` | | `Sys.CPU_THREADS` | 2 | `lscpu` output: Architecture: x86_64 CPU op-mode(s): 32-bit, 64-bit Address sizes: 46 bits physical, 48 bits virtual Byte Order: Little Endian CPU(s): 2 On-line CPU(s) list: 0,1 Vendor ID: GenuineIntel Model name: Intel(R) Xeon(R) Platinum 8272CL CPU @ 2.60GHz CPU family: 6 Model: 85 Thread(s) per core: 1 Core(s) per socket: 2 Socket(s): 1 Stepping: 7 BogoMIPS: 5187.80 Flags: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ss ht syscall nx pdpe1gb rdtscp lm constant_tsc rep_good nopl xtopology cpuid pni pclmulqdq ssse3 fma cx16 pcid sse4_1 sse4_2 movbe popcnt aes xsave avx f16c rdrand hypervisor lahf_lm abm 3dnowprefetch invpcid_single pti fsgsbase bmi1 hle avx2 smep bmi2 erms invpcid rtm avx512f avx512dq rdseed adx smap clflushopt avx512cd avx512bw avx512vl xsaveopt xsavec xsaves md_clear Hypervisor vendor: Microsoft Virtualization type: full L1d cache: 64 KiB (2 instances) L1i cache: 64 KiB (2 instances) L2 cache: 2 MiB (2 instances) L3 cache: 35.8 MiB (1 instance) NUMA node(s): 1 NUMA node0 CPU(s): 0,1 Vulnerability Itlb multihit: KVM: Mitigation: VMX unsupported Vulnerability L1tf: Mitigation; PTE Inversion Vulnerability Mds: Mitigation; Clear CPU buffers; SMT Host state unknown Vulnerability Meltdown: Mitigation; PTI Vulnerability Mmio stale data: Vulnerable: Clear CPU buffers attempted, no microcode; SMT Host state unknown Vulnerability Retbleed: Vulnerable Vulnerability Spec store bypass: Vulnerable Vulnerability Spectre v1: Mitigation; usercopy/swapgs barriers and __user pointer sanitization Vulnerability Spectre v2: Mitigation; Retpolines, STIBP disabled, RSB filling, PBRSB-eIBRS Not affected Vulnerability Srbds: Not affected Vulnerability Tsx async abort: Mitigation; Clear CPU buffers; SMT Host state unknown | Cpu Property | Value | |:------------------ |:------------------------------------------------------- | | Brand | Intel(R) Xeon(R) Platinum 8272CL CPU @ 2.60GHz | | Vendor | :Intel | | Architecture | :Skylake | | Model | Family: 0x06, Model: 0x55, Stepping: 0x07, Type: 0x00 | | Cores | 2 physical cores, 2 logical cores (on executing CPU) | | | No Hyperthreading hardware capability detected | | Clock Frequencies | Not supported by CPU | | Data Cache | Level 1:3 : (32, 1024, 36608) kbytes | | | 64 byte cache line size | | Address Size | 48 bits virtual, 46 bits physical | | SIMD | 512 bit = 64 byte max. SIMD vector size | | Time Stamp Counter | TSC is accessible via `rdtsc` | | | TSC increased at every clock cycle (non-invariant TSC) | | Perf. Monitoring | Performance Monitoring Counters (PMC) are not supported | | Hypervisor | Yes, Microsoft |
meggart commented 1 year ago

I forgot to mention that this will break the ArType argument for InDims. Wrapping the array in the inner function would only be possible with considerable overhead (ok, it might depend), so if you merge as it is, this would be breaking and we should update the docs for InDims

coveralls commented 1 year ago

Pull Request Test Coverage Report for Build 5483907376


Files with Coverage Reduction New Missed Lines %
src/DAT/registration.jl 1 75.0%
src/DAT/DAT.jl 22 72.57%
<!-- Total: 23 -->
Totals Coverage Status
Change from base Build 5476969869: -1.4%
Covered Lines: 953
Relevant Lines: 1690

💛 - Coveralls
github-actions[bot] commented 1 year ago

Pull Request Test Coverage Report for Build 5483907376


Files with Coverage Reduction New Missed Lines %
src/DAT/registration.jl 1 75.0%
src/DAT/DAT.jl 22 68.85%
<!-- Total: 23 -->
Totals Coverage Status
Change from base Build 5476969869: -1.4%
Covered Lines: 953
Relevant Lines: 1690

💛 - Coveralls
github-actions[bot] commented 1 year ago

Pull Request Test Coverage Report for Build 5483907376


Files with Coverage Reduction New Missed Lines %
src/DAT/registration.jl 1 75.0%
src/DAT/DAT.jl 22 68.85%
<!-- Total: 23 -->
Totals Coverage Status
Change from base Build 5476969869: -1.4%
Covered Lines: 953
Relevant Lines: 1690

💛 - Coveralls
felixcremer commented 1 year ago

This speeds up my c-scale runs by roughly a factor of two but it is still much slower as the previous wrong use of threading. I suspect, that I could also play around again a bit on the number of workers and number of threads, but for now this is fine and I hope to be able to run most of europe in the next weeks.

felixcremer commented 1 year ago

I think it is ok to not give the artype into the inner function, because this was mainly used for the axes values and they can be provided as extra cubes anyways. I should be updating the docs for the Axes as cube usage

meggart commented 1 year ago

Just a question, did you actually remove the :static from the threaded loop?