Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
Parallel STL course
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Michaël El Kharroubi
Parallel STL course
Commits
06d7d0fc
Commit
06d7d0fc
authored
1 year ago
by
Michaël El Kharroubi
Browse files
Options
Downloads
Patches
Plain Diff
[WIP] STL algos
parent
187f2b1b
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
GPGPU.typ
+1
-1
1 addition, 1 deletion
GPGPU.typ
cpp_basics_for_STL.typ
+71
-0
71 additions, 0 deletions
cpp_basics_for_STL.typ
with
72 additions
and
1 deletion
GPGPU.typ
+
1
−
1
View file @
06d7d0fc
...
...
@@ -86,7 +86,7 @@
#slide(title: "Déroulement classique d
'
un
programmme
GPGPU
"
)[
+ Le CPU envoie les données à traiter au GPU #pause
+ Le GPU applique un kernel sur les données #pause
+ Le CPU récupère le résultat
#pause
+ Le CPU récupère le résultat
]
#new-section-slide(
"
Exemple
de
code
CUDA
et
notions
à
retenir
"
)
...
...
This diff is collapsed.
Click to expand it.
cpp_basics_for_STL.typ
+
71
−
0
View file @
06d7d0fc
...
...
@@ -304,6 +304,77 @@ int x = add_cst(10); // x vaut 12
#new-section-slide(
"
Algorithmes
STL
"
)
#slide(
title:
"
Introduction
"
,
)[
La librairie standard propose un ensemble d'algorithmes qui permettent de
travailler avec des itérateurs.
Ces algorithmes permettent entre autre de :
- initialiser/remplir
- trier
- transformer
- réduire
- supprimer/remplacer des éléments
On retrouve des fonctions similaires avec les streams en java, ou les itérateurs
en Rust.
Je vous recommande de lire la page suivante pour plus d'information #link(
"
https
:
//
en
.
cppreference
.
com
/
w
/
cpp
/
algorithm
"
).
]
#slide(title:
"
Exemple
tri
"
)[
```cpp
std::vector<int> v = {6, 3, 4, 12, 1, 15};
std::sort(v.begin(), v.end());
std::vector<int> v_sorted = {1, 3, 4, 6, 12, 15};
bool is_sorted = std::equal(v.begin(), v.end(), v_sorted.begin());
std::cout << is_sorted << std::endl;
```
]
#slide(title:
"
Exemple
de
transformation
"
)[
```cpp
std::vector<int> v = {6, 3, 4, 12, 1, 15};
std::vector<std::string> parity{6};
std::transform(v.begin(),
v.end(),
parity.begin(),
[](int i){
std::string s = (i % 2) == 0 ?
"
even
"
:
"
odd
"
;
return s;
});
for (std::string &p : parity){
std::cout << p <<
"
"
;
}
std::cout << std::endl;
```
]
#slide(title:
"
Exemple
de
reduction
"
)[
```cpp
constexpr int kN = 100;
std::vector<int> v{kN, 0};
std::iota(v.begin(), v.end(), 1);
int sum = std::accumulate(v.begin(),
v.end(),
0,
[](int acc, int i){
return acc + i;
});
std::cout << sum << std::endl;
```
]
#new-section-slide(
"
Notions
à
retenir
"
)
#new-section-slide(
"
Questions
?
"
)
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment