Multi Producer, Multi Consumer, Lock Free, Atomic Queuetemplateclass QueueSchedulerIssue { std::atomic writeIndex; std::atomic readIndex; std::unique_ptr<std::pair > elements; bool try_push(T&& try_push(T&& value) { auto my_entry = writeIndex.fetch_add(1); elements[my_entry].first = std::move(value); // No code, does not mean no-time. // scheduler will hit here, and // block the queue while (elements[my_entry].second != my_entry) ; // spin and wait, maybe with pause(); value = std::move(elements[my_entry].first); return true; } }; Lockfree, MPMC Queue - Scheduler InteractionLockfree 0 码力 | 54 页 | 886.12 KB | 6 月前3
JAVA 应用与开发 - 集合与映射November 4, 2019 ���� �����List����Set�����Map�的������� ���������� ������iterator��Enumeration ��������� API ������的������������ 1 28 �� 1 ������� 2 Collection � Map �� 3 �� 4 Iterator �� 5 � 6 集合�����用���������������合����� �� O 集合类型分类 � Set ��������的������������� ������������的��� �� List ������的��������������� ������的���������������� �������� �� Map �����的��¡���Key-Value������ �������的��������������� 集合�����用���������������合����� �� O 集合类型分类 � Set ��������的������������� ������������的��� �� List ������的��������������� ������的���������������� �������� �� Map �����的��¡���Key-Value������ �������的���������������0 码力 | 66 页 | 713.79 KB | 1 年前3
Limitations and Problems in std::function and SimilarLimitations and Problems in std::function and similar constructs Amandeep Chawla | Sr. Computer Scientist II amandeep@adobe.com | adchawla@gmail.com Image by Bruno Tornielli© 2024 Adobe. All Rights whose type we can control. ▪ std::function© 2024 Adobe. All Rights Reserved. Adobe Confidential. Task Based Mechanism© 2024 Adobe. All Rights Reserved. Adobe Confidential. std::function ▪ Is a class template template ▪ It is a general-purpose polymorphic function wrapper ▪ Instances of std::function can store, copy, and invoke any CopyConstructible Callable target ▪ Uses type-erasure under the hood to gain0 码力 | 62 页 | 3.57 MB | 6 月前3
Spanny 2: Rise of std::mdspanhttps://github.com/kokkos/mdspangithub.com/griswaldbrooks/spanny2 goals ● deeper understanding of std::mdspan layouts and accessors ● how to write custom layouts and accessors ● dispel common misconceptions memory accessor ● improving memory access using asynchronicity 4 ● motivations for std::mdspan ● review std::mdspan declarationgithub.com/griswaldbrooks/spanny2 how ● layouts and their requirements memory accessor ● improving memory access using asynchronicity 5 ● motivations for std::mdspan ● review std::mdspan declarationgithub.com/griswaldbrooks/spanny2 how ● layouts and their requirements0 码力 | 117 页 | 2.02 MB | 6 月前3
A Long Journey of Changing std::sort Implementation at Scaleelements std::sort, std::stable_sort, ranges::sort, etc std::sort(begin, end); std::ranges::sort(cont); 4REMINDERS Sorting is the ordering of elements std::sort, std::stable_sort std::stable_sort, ranges::sort, etc std::sort(begin, end, comp); std::ranges::sort(cont, comp); 5QUICKSORT 6QUICKSORT Quick sort 6.1QUICKSORT Quick sort Take any element 6.2QUICKSORT __quick_sort_loop(first, last); 4 } 5 9Quick sort (STL version) 10STANDARD LIBRARY EVOLVED FROM STL 11STD::SORT 12STD::SORT 12.1Quicksort's worst case is Just pick the worst element 13GCC libstdc++ template0 码力 | 182 页 | 7.65 MB | 6 月前3
Bringing Existing Code to CUDA Using constexpr and std::pmrAllocation // cpu std::vectorx(N); std::vector y(N); // … // gpu // ??? // ??? // … 15 |• Added in C++17: • std::pmr::memory_resource • std::pmr::polymorphic_allocator • std::pmr::vector std::pmr::vector • std::pmr::monotonic_buffer_resource • … std::pmr 16 |// gpu unified_memory_resource mem; std::pmr::vector x(N, &mem); std::pmr::vector y(N, &mem); // … Memory Allocation 17 |struct rce : std::pmr::memory_resource { void* do_allocate(std::size_t, std::size_t); void do_deallocate( void* p, std::size_t, std::size_t); bool do_is_equal( const std::pmr::memory_resource& 0 码力 | 51 页 | 3.68 MB | 6 月前3
Vectorizing a CFD Code With std::simd Supplemented by Transparent Loading and StoringCenter (DLR) Institute of Software Methods for Product Virtualization VECTORIZING A CFD CODE WITH STD::SIMD SUPPLEMENTED BY (ALMOST) TRANSPARENT LOADING AND STORINGMotivation: The Origin of the Talk deduction to load and store std::simd and scalar variables ▪ syntactically equalize scalar and vectorized code The talk: ▪ share experience with vectorization using std::simd ▪ introduce the SIMD_ACCESS instruction adds/multiplies/… multiple set of operands at once → Single Instruction Multiple Data (SIMD) For more details Matthias Kretz‘ Cppcon talk about std::simd: https://youtu.be/LAJ_hywLtMA0 码力 | 58 页 | 2.68 MB | 6 月前3
Is std::mdspan a Zero-overhead Abstraction? - Oleksandr Bakirov - CppConIs std::mdspan a Zero-overhead Abstraction? Oleksandr Bacherikov Snap IncWhat is std::mdspan? It’s a view over a multi-dimensional array. It’s designed primarily to be used as a function parameter parameter. 3What is the simplest multi-dimensional function? 4What is the simplest multi-dimensional function? Let’s take the smallest dimension more than 1, which is 2. The most common 2-dimensional object object is a matrix. 5What is the simplest multi-dimensional function? Let’s take the smallest dimension more than 1, which is 2. The most common 2-dimensional object is a matrix. Let’s take a simple operation0 码力 | 75 页 | 1.04 MB | 6 月前3
Techniques to Optimise Multi-threaded Data Building During Game Development1 Dominik Grabiec - Techniques to Optimise Multi-threaded Data Building During Game Development - CppCon 2024Hello My name is Dominik Grabiec This talk isFocusing on optimising the process around Consists of many jobs - on many threads SpinLock is sync primitive - spins rather than sleeping Flat map is associative container Stores items in arrays - keys in sorted array - giving O(logn) access Speaker Partition 3D space into cube grid ▪ Distribute items into grid cells ▪ Store non-empty cells in a map 19Presenting GridCache - alternative data structure for fast 3D lookups Created this when developing 0 码力 | 99 页 | 2.40 MB | 6 月前3
C++高性能并行编程与优化 - 课件 - 17 由浅入深学习 map 容器由浅入深学习 map 容器 by 彭于斌( @archibate ) 我负责监督你鞋习 ! 我负责监督你鞋习 ! 本期看点: 用方括号 [ ] 取出 map 元素居然是错误的! 能不能在遍历的同时删除元素?安全吗? emplace , emplace_hint , try_emplace 的区别? 课程安排 1. vector 容器初体验 & 迭代器入门 (BV1qF411T7sd) 2 2. 你所不知道的 set 容器 & 迭代器分类 (BV1m34y157wb) 3. string , string_view , const char * 的爱恨纠葛 (BV1ja411M7Di) 4. 万能的 map 容器全家桶及其妙用举例 ( 本期 ) 5. 函子 functor 与 lambda 表达式知多少 6. 通过实战案例来学习 STL 算法库 7. C++ 标准输入输出流 & 字符串格式化 第一章:读取与写入 我负责监督你鞋习 ! 我负责监督你鞋习 ! map 查找元素的两个接口 • map 提供了两个查找元素的接口,一曰 [] ,二曰 at 。 • 那么他们两个又有什么区别呢?很多新手都分不清他俩,可能只认识 [] 。 读取 map 元素 • mapm; • 读取 map 中指定键值的元素有两种方法。 • val = m[“key”]; 0 码力 | 90 页 | 8.76 MB | 1 年前3
共 1000 条
- 1
- 2
- 3
- 4
- 5
- 6
- 100
相关搜索词
MultiProducerConsumerLockFreeAtomicQueueSetlistmappdfLimitationsandProblemsinstdfunctionSimilarSpannyRiseofmdspanLongJourneyChangingsortImplementationatScaleBringingExistingCodetoCUDAUsingconstexprpmrVectorizingCFDWithsimdSupplementedbyTransparentLoadingStoringIsZerooverheadAbstractionOleksandrBakirovCppConTechniquesOptimisethreadedDataBuildingDuringGameDevelopmentC++高性性能高性能并行编程优化课件17













