Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:01:40

0001 
0002 // Copyright 2020, Jefferson Science Associates, LLC.
0003 // Subject to the terms in the LICENSE file found in the top-level directory.
0004 #pragma once
0005 
0006 #ifndef JANA2_CACHE_LINE_BYTES
0007 #define JANA2_CACHE_LINE_BYTES 64
0008 #endif
0009 // The cache line size is 64 for ifarm1402. gcc won't allow larger than 128
0010 // You can find the cache line size in /sys/devices/system/cpu/cpu0/cache/index0/coherency_line_size
0011 /*! The cache line size is useful for creating a buffer to make sure that a variable accessed by multiple threads does not share the cache line it is on.
0012     This is useful for variables that may be written-to by one of the threads, because the thread will acquire locked access to the entire cache line.
0013     This blocks other threads from operating on the other data stored on the cache line. Note that it is also important to align the shared data as well.
0014     See http://www.drdobbs.com/parallel/eliminate-false-sharing/217500206?pgno=4 for more details. */
0015 
0016 
0017 #include <thread>
0018 
0019 namespace JCpuInfo {
0020 
0021     size_t GetNumCpus();
0022 
0023     uint32_t GetCpuID();
0024 
0025     bool PinThreadToCpu(std::thread *thread, size_t cpu_id);
0026 
0027 }