-
## +24
## Designing a Slimmer Vector of Variants
## CHRISTOPHER FRETZ
## Designing a Slimmer Vector of Variants
Engineering
CppCon 2024
September 18, 2024
Chris Fretz
Senior C++ Engineer
TechAtBloomberg details my experience in creating a novel solution to an observed problem with memory usage of std::vector<std::variant<...>>
- The talk starts with the motivating use case, considers several candidate 2024 Bloomberg Finance L.P. All rights reserved.
Bloombergstd::variant<...>
## Motivation
• Heterogeneous containers like std::vector<std::variant<...>> are an extremely natural way to represent
0 码力 |
64 页 |
1.98 MB
| 1 年前 3
-
# Lecture Notes on Support Vector Machine
Feng Li
fli@sdu.edu.cn
Shandong University, China
## 1 Hyperplane and Margin
In a n-dimensional space, a hyper plane is defined by
$$ \omega^{T}x+b=0 $$ $$
where $ \omega\inR^{n} $ is the outward pointing normal vector, and b is the bias term. The n-dimensional space is separated into two half-spaces $ H^{+}=\{x\inR^{n}\mid\omega^{T}x+b\geq0\} $ and 7/4/ca747b9d33d07aa393893fb3862bcd67/p2_1.jpg)
Figure 1: Margin and hyperplane.
## 2 Support Vector Machine
### 2.1 Formulation
The hyperplane actually serves as a decision boundary to differentiating
0 码力 |
18 页 |
509.37 KB
| 2 年前 3
-
## Lecture 6: Support Vector Machine
Feng Li
Shandong University
fli@sdu.edu.cn
December 28, 2021
## Outline

1 SVM: nts/4/1/3/0/41305aec36322a1beae76d1d88486b9a/p3_1.jpg)
• Defined by an outward pointing normal vector $ \omega \in R^{n} $
• Assumption: The hyperplane passes through origin. If not,
• have a bias 0 means moving it parallelly along $ \omega $ (b < 0 means in opposite direction)
## Support Vector Machine
• A hyperplane based linear classifier defined by $ \omega $ and b
• Prediction rule:
0 码力 |
82 页 |
773.97 KB
| 2 年前 3
-
## +24
## Back To Basics Almost Always
Vector
## KEVIN CARPENTER
#### My professor is telling us to NEVER use vectors. EDIT 3: Holy cow, that is a LOT of comments. I've read through a lot of them #include
#include
#include <vector>
int a[] = {0, 1, 2, 3, 4};
std::vector c = {0, 1, 2, 3, 4};
auto main() -> int {
std::cout << "C style array: " << << sizeof(a) / sizeof(a[0]) << std::endl;
std::cout << "Vector size: " << c.size() << std::endl;
return 0;
}vector>
> callback
);
## Lambdas
// print all the elements of vector of int.
std::for_each(c.begin(), c.end(), [(int i) {
std::cout
});
// Sort the vector using a lambda function
std::sort(v.begin(), v.end(), [](int a, int b) {
return a < b;
});
// find the object with id "c" in a vector of objects
// having
0 码力 |
62 页 |
3.57 MB
| 1 年前 3
-
## +24
## spanny 2: Rise of std::mdspan
## GRISWALD BROOKS
## 20 24 September 15 - 20
##### DISCLAIMER: C++23... ish

understanding of std::mdspan layouts and accessors
• how to write custom layouts and accessors
• dispel common misconceptions about both
## how
• motivations for std::mdspan
- review std::mdspan declaration memory accessor
improving memory access using asynchronicity
## how
• motivations for std::mdspan
- review std::mdspan declaration
• layouts and their requirements
• occupancy grids and default layouts
0 码力 |
117 页 |
2.02 MB
| 1 年前 3
-
## A Long Journey of Changing std::sort Implementation at Scale
## DANILA KUTENIN
## WHO AM I?
• Senior Software Engineer at Google
• DC efficiency
## AGENDA FOR TODAY
• History of sorting
• Why have ordering of elements
• std::sort, std::stable_sort, ranges::sort, etc
std::sort(begin, end);
std::ranges::sort(cont);
## REMINDERS
• Sorting is the ordering of elements
• std::sort, std::stable_sort, ranges::sort ranges::sort, etc
std::sort(begin, end, comp);
std::ranges::sort(cont, comp);
## QUICKSORT
## QUICKSORT
• Quick sort
## QUICKSORT
• Quick sort
• Take any element
## QUICKSORT
• Quick sort
• Take any
0 码力 |
182 页 |
7.65 MB
| 1 年前 3
-
## +21
## Bringing Existing Code to CUDA Using constexpr and std::pmr
BOWIE OWENS
20
21
October 24-29
## Outline
• Introduction
• Memory
• Host vs Device Functions
• Return on Investment
• Concluding Allocation
// cpu
std::vector x(N); // ????
std::vector y(N); // ...
## std::pmr
• Added in C++17:
• std::pmr::memory_resource
• std::pmr::polymorphic_allocator
• std::pmr::vector std::pmr::vector
• std::pmr::monotonic_buffer_resource
// ...
## Memory Allocation
// gpu
unified_memory_resource mem;
std::pmr::vector x(N, &mem);
std::pmr::vector y(N, &mem);
0 码力 |
51 页 |
3.68 MB
| 1 年前 3
-
List-like Data Structures
## YANNIC BONENBERGER
## List-like data structures
• std::vector
• std::list
• std::deque
## std::vector
• C++ version of the array-list data structure
• Backed by a C-style array allocates a new backing array when inserting into a "full" std::vector
## std::vector
1 template
2 class vector {
3 public:
4 // constructor, accessors, ...
}
6 private:
7 size_t size_;
8 size_t capacity_;
10};
9 T* data_;
## std::vector
• Compact layout – elements stored in contiguous memory
• Inserting or removing elements at the end is
0 码力 |
29 页 |
852.61 KB
| 1 年前 3
-
## +23
## I s
std::mdspan a Zero-overhead Abstraction?
## OLEKSANDR BACHERIKOV
## I s
std::mdspan a Zero-overhead Abstraction?
Oleksandr Bacherikov
Snap Inc
## What is
std::mdspan?
It's a view to C++
If the matrices are contiguous in memory, then we can treat them as ranges and simply use
std::transform
$$ \{-5,\quad5,\quad-3,\quad1,\quad4,\quad0\} $$
$$ \{3,2,1,3,-5,4\} $$
$$ \{-2 colspan="2">options
dim | b-width | scalar | matrix | vector | scalar | vector | | xGEMV | ( | TRANS, | M, N, | ALPHA 0 码力 |
75 页 |
1.04 MB
| 1 年前 3
|