Tag: programming

Generating Parsers in C++ with Maphoon – Part 1 of 2 – Hans de Nivelle – CppCon 2022

  • Lobby
  • Tag Archives: programming

https://cppcon.org/
---

Generating Parsers in C++ with Maphoon - Part 1 of 2 - Hans de Nivelle - CppCon 2022
https://github.com/CppCon/CppCon2022

We introduce a tool for generating parsers in C++, and use it to demonstrate theory-based bottom-up parsing. The tool is written in C++17, and creates parsers in C++17. When compiling a programming language (like for example Python or Java), the compiler starts with creating a tree representation of the input. This process is called 'parsing'.

Parsing consists of two stages: The first stage cuts the input text into atomic pieces (like numbers, identifiers, operators, and strings). This stage is called 'tokenizing'. The second stage builds the tree representation from the tokens. The resulting tree representation is usually called 'AST' (Abstract Syntax Tree).

Our tool supports both stages of parsing: For the first stage, one can use regular expressions combined with own code. For the second stage, one must give the description of a formal grammar together with code fragments that build the AST.
The parser generator reads this description and creates an executable LALR-parser.

My parser generation tool is designed to be user friendly, flexible, to support modern C++, to generate efficient parsers, and to be transparent about the underlying theory, so that it can be used in teaching. It is possible to show the parsing process and the underlying automata. It allows runtime definition of operators, and fine tuning of error messages, which is traditionally a weakness of bottom-up parsing.
---

Hans de Nivelle

Hans de Nivelle has a PhD from Delft University in the Netherlands. Topic of the thesis were techniques for automated proof search in logic. From 1999 to 2007, he worked as a full time researcher at Max-Planck Institute for Computer Science in Saarbruecken, Germany. His main research topic was still automated proof search. Since this involves search, one needs efficient implementation. For this purpose, he started using C++ in 2003.

From 2007-2017, Hans de Nivelle was professor at University of Wroclaw, Poland, where he continued doing research on automated proof search but in combination with interactive proof construction. In Wroclaw, he taught formal logic, compiler construction, flight simulation, and programming in C++.

From 2018 until present, Hans de Nivelle is professor at Nazarbayev University, Kazakhstan. In the last three years, he has been teaching programming in Haskell, Prolog, Java, Python, C, and C++, as well as formal language theory and compiler construction. He is currently working on a compiler for a new programming language for logic, which is being implemented in C++. The current talk about parser generation in C++ is a result of this project. When this programming language will be finished some day, Hans de Nivelle hopes to return to logic as his main research topic and become a user of his own programming language.
__

Videos Streamed & Edited by Digital Medium: http://online.digital-medium.co.uk

#cppcon #programming #parsing

Filed under: UncategorizedTagged with: , , , ,

C++ Coroutines, from Scratch – Phil Nash – CppCon 2022

  • Lobby
  • Tag Archives: programming

https://cppcon.org/
---

C++ Coroutines, from Scratch - Phil Nash - CppCon 2022
https://github.com/CppCon/CppCon2022

C++ 20 introduced coroutines into the language. Coroutines have the potential to greatly simplify some types of code - particularly, but not limited to, anything asynchronous in nature. But early adoption has been hindered by both the lack of library support in the standard and the inherent complexity of the feature itself (which, due to that lack of library support, you are typically more exposed to).

Now we have a bit of a “Blind men and an elephant” problem - where we’re getting disjointed glimpses of what coroutines, supposedly, are - without the big picture. I can’t claim to be able to give you a comprehensively big enough picture in a 60 or 120 minute talk, but my aim is to plot a journey through it by starting with a motivating example (a typical multiple async task problem), looking at how we might approach this without coroutines, then seeing what coroutines can do for us - and finally looking at what that would look like with library support.
---

Phil Nash

Phil Nash is the original author of the C++ test framework, Catch2, and composable command line parser, Clara. As Developer Advocate at SonarSource he’s involved with SonarQube, SonarLint and SonarCloud, particularly in the context of C++. He’s also a member of the ISO C++ standards committee, organiser of C++ London and C++ on Sea, as well as co-host and producer of the Cpp.chat and No Diagnostic Required podcasts.

More generally Phil’s an advocate for good testing practices, TDD and using the type system and functional techniques to reduce complexity and increase correctness. He’s previously worked in Finance and Mobile and offers training and coaching in TDD for C++.
__

Videos Filmed & Edited by Bash Films: http://www.BashFilms.com
YouTube Channel Managed by Digital Medium Ltd https://events.digital-medium.co.uk

#cppcon #programming #coroutines

Filed under: UncategorizedTagged with: , , , ,

Sockets – Applying the Unix Readiness Model When Composing Concurrent Operations in C++ – Filipp Gelman – CppCon 2022

  • Lobby
  • Tag Archives: programming

https://cppcon.org/
---

What I Learned From Sockets - Applying the Unix Readiness Model When Composing Concurrent Operations in C++ - Filipp Gelman - CppCon 2022
https://github.com/CppCon/CppCon2022

Unix systems implement a rich set of primitives for working concurrently with file descriptors. Interfaces like select, poll, epoll, and kqueue allow the caller to wait until an event occurs on any of the specified file descriptors - that is, until at least one of them becomes "ready" for some operation. The Go programming language has a "select" statement with similar semantics. It may be used to wait for any of several "channels" to become ready.

This talk will demonstrate to attendees that such an approach is also viable for solving problems that involve concurrent operations. It will also how C++ concurrency mechanisms could support similar semantics. By the end, it will provide answers to questions like: "How can I .get() the first of several futures?" and "How can I co_await the first of several coroutines?"
---

Filipp Gelman

At Bloomberg LP since 2016, Filipp enjoys exploring the obscure, arcane, and esoteric corners of the C++ language. He is known among his coworkers for heavy use of templates, emphasis on compile time computation, and abusing language features for nefarious purposes.
---

Videos Streamed & Edited by Digital Medium: http://online.digital-medium.co.uk

#cppcon #programming #unix

Filed under: UncategorizedTagged with: , , , , , , ,

Optimizing Binary Search – Sergey Slotin – CppCon 2022

  • Lobby
  • Tag Archives: programming

https://cppcon.org/
---

Optimizing Binary Search - Sergey Slotin - CppCon 2022
https://github.com/CppCon/CppCon2022

People generally don’t get very excited over 5-10% performance improvements in some databases. Yes, this is what software engineers are paid for, but these types of optimizations tend to be too intricate and system-specific to be readily generalized to other software.

Instead, the most fascinating showcases of performance engineering are multifold improvements of textbook algorithms: the kinds that everybody knows and deemed so simple that it would never even occur to try to optimize them in the first place. These optimizations are simple and instructive and can very much be adopted elsewhere — and they are surprisingly not as rare as you would think.

In this talk, we will focus on one such fundamental algorithm — binary search — and discuss several ways of making it faster using branchless programming, memory layout optimization, and SIMD instructions, and eventually develop an algorithm that is up to ~15x faster than std::lower_bound.
---

Sergey Slotin
Sergey Slotin is the author of Algorithms for Modern Hardware (en.algorithmica.org/hpc).
---

Videos Streamed & Edited by Digital Medium: http://online.digital-medium.co.uk

#cppcon #programming #binarysearch

Filed under: UncategorizedTagged with: , , , , ,

GPU Accelerated Computing & Optimizations on Cross-Vendor Graphics Cards with Vulkan & Kompute – by Alejandro Saucedo

  • Lobby
  • Tag Archives: programming

https://cppcon.org/
---

GPU Accelerated Computing and Optimizations on Cross-Vendor Graphics Cards with Vulkan & Kompute - Alejandro Saucedo - CppCon 2022
https://github.com/CppCon/CppCon2022

Many advanced data processing paradigms fit incredibly well to the parallel-architecture that GPU computing offers, and exciting advancements in the open source projects such as the Vulkan SDK (a collection of tools for cross-vendor GPU development) and the Kompute Project (a Linux Foundation open source project that enables cross-vendor general-purpose GPU programming) are enabling developers to take advantage of general purpose GPU computing capabilities in cross-vendor mobile and desktop GPUs, including over 1000 GPUs across AMD, Qualcomm, NVIDIA & many more graphics processors. In this talk we will provide a conceptual and practical insight into the cross-vendor GPU compute ecosystem as well as how to adopt these tools to add GPU acceleration to your existing C++ applications.

In this talk we will show how you can write a simple GPU accelerated machine learning algorithm from scratch which will be able to run on virtually any GPU. We will give an overview on the projects that are making it possible to accelerate applications across cross-vendor GPUs. We'll show how you can get started with the full power of your GPU using the Kompute framework with only a handful of lines of C++ code, as well as providing an intuition around how optimizations can be introduced through the lower level C++ interface.

As part of the more advanced example, we will showcase some optimizatiosn that can be leveraged through the hardware capabilities of relevant graphics cards, such as concurrency-enabled GPU queues which allow us to introduce 2x+ performance improvements into advanced data processing workloads. We will dive into the GPU computing terminology around asynchronous & parallel workflow processing, cover the core principles of data parallelism, explain the hardware concepts of GPU queues & queueFamilies, and talk about how advancements in new and upcoming graphics cards will enable for even bigger speedups (such as the more recent GPU architectures which will support 3 or now even more parallel queue processing workloads).
---

Alejandro Saucedo

Alejandro is the Chief Scientist at the Institute for Ethical AI & Machine Learning, where he contributes to policy and industry standards on the responsible design, development and operation of AI, including the fields of explainability, GPU acceleration, ML security and other key machine learning research areas. Alejandro Saucedo is Director of Engineering at Seldon Technologies, where he leads teams of machine learning engineers focused on the scalability and extensibility of machine learning deployment and monitoring products. With over 10 years of software development experience, Alejandro has held technical leadership positions across hyper-growth scale-ups and has a strong track record building cross-functional teams of software engineers. He is currently appointed as governing council Member-at-Large at the Association for Computing Machinery, and is currently the Chairperson of the GPU Acceleration Kompute Committee at the Linux Foundation.

LInkedin: https://linkedin.com/in/axsaucedo
Twitter: https://twitter.com/axsaucedo
Github: https://github.com/axsaucedo
Website: https://ethical.institute/
---

Videos Streamed & Edited by Digital Medium: http://online.digital-medium.co.uk

#cppcon #programming #gpu

Filed under: UncategorizedTagged with: , , , , ,

Nth Pack Element in C++ – A Case Study – Kris Jusiak – CppCon 2022

  • Lobby
  • Tag Archives: programming

https://cppcon.digital-medium.co.uk/tag/cppcon/">cppcon.org/
---

Nth Pack Element in C++ - A Case Study - Kris Jusiak - CppCon 2022
https://github.com/CppCon/CppCon2022

Varadic packs have been with us since C++11, however getting the nth element efficiently out of a variadic pack still remains not optimal/difficult.
During the years, with new standards emerging, more and more approaches have been discovered but no silver bullet has been found yet or has it?
If understanding of how std::get<N>(tuple) works sounds compeling then this session is for you!

In this case study we will explore different techniques of accessing the nth element of a variadic pack... starting from naive approaches, through template meta-cppcon.digital-medium.co.uk/tag/programming/">programming tricks, to compiler intrinsics. We will also focus and deep dive into C++20 features which enables new techniques in order to understand modern ways of dealing with variadic packs...

Comparison against different solutions also will be conducted including compilation times as well as readability including comparison between different languages such as Rust, Nim, D, Circle and C++.

At the end of this session, the audience will have a better understanding of C++20 features and how to deal with variadic packs... and how it compares to different system languages.

Let's get ready to get nth element at CppCon 2022!
---

Kris Jusiak

Kris is a Senior Software Architect passionate about cppcon.digital-medium.co.uk/tag/programming/">programming and who has worked in different industries over the years including telecommunications, games and most recently finance for Quantlab Financial, LLC. He has an interest in modern C++ development with a focus on performance and quality. He is an open-source enthusiast with multiple open-source libraries where he uses template meta-cppcon.digital-medium.co.uk/tag/programming/">programming techniques to support the C++ rule - "Don't pay for what you don't use" whilst trying to be as declarative as possible with a help of domain-specific languages. Kris is also a keen advocate of extreme cppcon.digital-medium.co.uk/tag/programming/">programming techniques, Test/Behavior Driven Development and truly believes that 'the only way to go fast is to go well!'.
__

Videos Filmed & Edited by Bash Films: http://www.BashFilms.com
YouTube Channel Managed by Digital Medium Ltd https://events.digital-medium.co.uk

#cppcon.digital-medium.co.uk/tag/cppcon/">cppcon #cppcon.digital-medium.co.uk/tag/programming/">programming #cpp

Filed under: UncategorizedTagged with: , , , , , ,

What Is an Image? – Cpp Computer Graphics Tutorial, (GPU, GUI, 2D Graphics and Pixels Explained) – Will Rosecrans

  • Lobby
  • Tag Archives: programming

https://cppcon.org/
---

What Is an Image, Anyway? - Cpp Computer Graphics Tutorial, (GPU, 2D Graphics, GUI, Colorspaces, YUT, Planter Formats & Pixels Explained) - Will Rosecrans - CppCon 2022
https://github.com/CppCon/CppCon2022

We all have at least a vague idea of what an image is, and that they are useful. It has even been proposed that 2D graphics functionality be added to the C++ language. But many developers haven't gotten too far into the weeds with the topic. What is an image? Sure, it's a 2D array of pixels. But what are pixels? What do the values in the pixels really mean? And, are you sure it's always just a single 2D array? Or that every pixel format actually stores discrete pixels? The reality is that the concept of an image can be blurry and filled with corner cases that will bewilder the newcomer and exasperate even experts.

Take a journey from the absolute basics of images in a computer, through a brief survey a more advanced topics. How much memory you need to allocate for n pixels. Alignment of pixels for efficient processing. Types like 12 bit int and half-float that aren't native C++ types. Almost (but not quite) compatible pixel formats across some common API's. Colorspaces. Colorspaces, but as defined from a slightly different niche. Colorspaces. Subsampling used in video formats. Some of the complexities from using a GPU, like compressed formats and mixed type formats. The performance implications of needing redundant copies of pixel data to interoperate between different libraries and API's. And how much of this you need to be aware of when making API's that might get used by developers with use cases you hadn't considered.
---

Will Rosecrans

Will Rosecrans is an independent software developer. He has recent experience working at global scale on the EdgeCast/Edgio content delivery network which handles billions of web requests and video streams. He worked on build and CI systems for C++ server software and his work led to a patent on rapid configuration propagation. He previously worked in the visual effects industry, working on pipeline technology at Moving Picture Company, and was responsible for the general care and feeding of pixels and servers for advertising, TV and film projects. His academic background in film production includes the UCLA film production Summer Institute.
---

Videos Filmed & Edited by Bash Films: http://www.BashFilms.com
YouTube Channel Managed by Digital Medium Ltd https://events.digital-medium.co.uk

#cppcon #programming #gpu

Filed under: UncategorizedTagged with: , , , ,

A Pattern Language for Expressing Concurrency in Cpp – Lucian Radu Teodorescu – CppCon 2022

  • Lobby
  • Tag Archives: programming

https://cppcon.org/
---

A Pattern Language for Expressing Concurrency in Cpp - Lucian Radu Teodorescu - CppCon 2022
https://github.com/CppCon/CppCon2022

Concurrency is still largely an unsolved problem. It is said that concurrency appeared in the software world in 1965, when Dijkstra provided a solution to the mutual exclusion problem. It is worth mentioning that this happened before 1968, when we officially started to use the term “Software Engineering”. We embraced structured programming in late 1960s and early 1970s for general code, but never managed to apply structured concurrency on a large scale up to this date. We are still writing our concurrent code in a largely unstructured manner. This is mainly the reason for which concurrency is a large frustration within the C++ community.

In C++, we don’t have so far a model to do structured concurrency. However, this is about to change with senders/receivers proposal. The proposal has high chances to land in the C++26 standard. Meanwhile, there are libraries implementing the proposal, so that people can start using it already. But, between having the proposal available to use and using it efficiently, there is a big gap.

This talk aims at providing a framework for programmers to use the senders/receivers proposal for addressing concurrency. We will define a pattern language for concurrency problems. Moreover, we will propose a visual representation of these patterns, making it easier for programmers to picture and argue about the structure of the concurrency. Through all these, the talk will show that concurrency of a software system can be described and analyzed just like any other architectural concern.
---

Lucian Radu Teodorescu

Lucian Radu Teodorescu has a PhD in programming languages and is a Staff Engineer at Garmin. He likes challenges; and understanding the essence of things (if there is one) constitutes the biggest challenge of all.
---

Videos Filmed & Edited by Bash Films: http://www.BashFilms.com
YouTube Channel Managed by Digital Medium Ltd https://events.digital-medium.co.uk

#cppcon #programming #concurrency

Filed under: UncategorizedTagged with: , , , ,

-memory-safe C++ – Jim Radigan – CppCon 2022

  • Lobby
  • Tag Archives: programming

https://cppcon.digital-medium.co.uk/tag/cppcon/">cppcon.org/
---

-memory-safe C++ - Jim Radigan - CppCon 2022
https://github.com/CppCon/CppCon2022

Memory safety issues are one of the most costly and common of software vulnerabilities. They were listed as 6 out of the 2021 CWE (Common Weakness Enumeration) Top 25, and account for 40% of the total points scored for all categories of the Most Dangerous Software Weaknesses listed. To combat this, we introduce a new compiler and runtime to enable building memory safe C++ and C applications. The binaries built with this new tooling require no modifications to source code and can find common memory safety issues such as buffer overflow, double free, use-after-free, new-delete type mismatch, and much more, at compile-time and runtime.

In this talk, we will present the new tooling and discuss how static analysis is key to early detection of program errors in the developer’s inner loop. Using concise examples, we will illustrate scenarios where static analysis can never completely prove memory safety for unaltered C++ or C. We demonstrate how our new tooling addresses memory safety with formal analysis that falls back to runtime checks when required for all safety guarantees. All runtime checks diagnose, report, and allow the application to continue.
---

Jim Radigan

Architect with over twenty years of experience shipping code gen. technology at Microsoft. Shipped C++ compilers, JIT’s, runtimes, and built large retail operating systems for initial release. Experience leading teams, recruiting, while implementing key technologies on the critical path. Implemented key compiler technology for SSA based global optimizations, vectorization, parallelization, coroutines, hot-patching, secure code gen, Asan, JIT’s and IDE functionality. Started and shipped: platforms on V1 hardware and created lasting cross-team processes to bring up Windows XP through Win 11 (for x86, X64, arm, arm64).
---

Videos Filmed & Edited by Bash Films: http://www.BashFilms.com
YouTube Channel Managed by Digital Medium Ltd https://events.digital-medium.co.uk

#cppcon.digital-medium.co.uk/tag/cppcon/">cppcon #cppcon.digital-medium.co.uk/tag/programming/">programming #cpp

Filed under: UncategorizedTagged with: , , , ,

Back to Basics: Standard Library Containers in Cpp – Rainer Grimm – CppCon 2022

  • Lobby
  • Tag Archives: programming

https://cppcon.org/
---

Back to Basics: Standard Library Containers in C++ - Rainer Grimm - CppCon 2022
https://github.com/CppCon/CppCon2022

From a bird’s-eye view, the Standard Template Library (STL) consists of three components. Those are containers, algorithms that run on the containers, and iterators that connect both of them. The STL has five sequential and eight associative containers. I hear your question:

* When should I use a sequence container or an associative one?

* When I decided for a sequence container or an associative one, which one should I use?

The answers to these questions depends mainly on two facts: use case and performance.

You may not know it but std::array and std::vector are your best friends for sequence containers, and you are most of the time fine with std::unordered_map when you need an associative container.
---

Rainer Grimm

Rainer has worked as a software architect, team lead, and instructor since 1999. In 2002, Rainer created a company-intern meeting for further education and had given training courses since 2002. Rainer's first tutorials were about proprietary management software, but he began teaching Python and C++ soon after. In his spare time, he likes to write articles about C++, Python, and Haskell and speak at conferences. Rainer publishes weekly on his English blog Modernes C++. Since 2016, Rainer has been an independent instructor, giving seminars about modern C++ and Python. Due to his profession, he constantly searches for the best way to teach modern C++. He published several books in various languages about modern C++ in the last ten years, including the last one "C++ Core Guidelines Explained: Best Practices for Modern C++".
---

Videos Filmed & Edited by Bash Films: http://www.BashFilms.com
YouTube Channel Managed by Digital Medium Ltd https://events.digital-medium.co.uk

#cppcon #programming #stl

Filed under: UncategorizedTagged with: , , , ,