CppCon Program Preview, 6 of N -- Boris Kolpackov

cppcon-081.pngMore CppCon 2014 accepted talks have just been announced, below. For past announcements about the conference program, see also:

Early Bird registration is available until June 30.

 

CppCon Program Preview, 6 of N

by Boris Kolpackov

From the announcement:

Stefanus Du Toit: “Hourglass Interfaces for C++ APIs”
Pedro Ramalhete, Andreia Correia: “How to Make Your Data Structures Wait-Free for Reads”
Gor Nishanov: “await 2.0: Stackless Resumable Functions”
Fedor Pikus: “Where did My Performance Go? (Scaling Visualization in Concurrent C++ Programs)”
Łukasz Mendakiewicz: “Viewing the World Through Array-Shaped Glasses”

 

Stefanus Du Toit: “Hourglass Interfaces for C++ APIs”

C++ provides a much richer set of abstractions than C. Classes, templates, overloading, and other core C++ features can be leveraged for more readable syntax, better compile time typechecking, more open ended genericity and improved modularity. On the flip side, C89 still boasts some advantages over C++, especially when viewed through a pragmatic lens. C ABIs on many platforms have been stable for decades, practically every language supports binding to C code through foreign function interfaces, and including nearly any C89 header has a negligible effect on compile time on modern computers. The Hourglass pattern provides the best of both worlds. It’s a way to structure libraries that retains the pragmatic benefits of C89 while still providing C++’s richness both at an interface and implementation level. It makes providing bindings from other languages to C++ libraries easier, and insulates from ABI issues such as incompatibilities between debug and release variants of runtimes. This talk provides an overview of the pattern, teaches practical techniques for its implementation using C++98 and C++11, and shares experience from using the pattern in real world projects.

Speaker’s bio: Stefanus Du Toit is a Software Lead at Thalmic Labs, where he enables amazing gestural experiences using the Myo armband. Stefanus previously worked as a Software Architect and Software Development Manager at Intel Corporation, and co-founded RapidMind (acquired by Intel), a startup that targeted GPUs and other processors using standard C++. Stefanus served on the C++ standards committee as Project Editor for C++14 and as Committee Secretary. He lives in Kitchener-Waterloo, Ontario, Canada and holds a BMath CS from the University of Waterloo.

 

Pedro Ramalhete, Andreia Correia: “How to Make Your Data Structures Wait-Free for Reads”

In this talk we will describe a new concurrency control algorithm with Blocking write operations and Wait-Free Population Oblivious read operations, which we named the Left-Right algorithm. We will show a new pattern where this algorithm is applied, which requires using two instances of a given resource, and can be used for any data structure, allowing concurrent access to it similarly to a Reader-Writer lock, but in a non-blocking manner for reads, including safe memory management without needing a GC.

Speaker’s bio: Pedro Ramalhete has a PhD in Particle Physics for research done at CERN. Most of the research itself required programming in C++, and he also had a major participation in the coding of the experiment’s data acquisition and decoding software in C and C++. Pedro is currently working at Cisco writing networking software, with emphasis on real-time concurrent synchronization techniques, and wait-free/lock-free data structures.

 

Gor Nishanov: “await 2.0: Stackless Resumable Functions”

When dealing with the task/future based asynchronous model, developers need to write lambda-heavy continuation code with potentially multiple nesting lambdas. This makes the code less readable and not very pleasant to write. Stackless resumable functions allow developers to use more natural imperative coding style and provide performance benefits that are not possible with library-only solutions.

Speaker’s bio: Gor Nishanov is a Principal Software Design Engineer on the Microsoft C++ team. He works on the ‘await’ feature. Prior to joining the C++ team, Gor was working on distributed systems in Windows Clustering team.


Fedor Pikus: “Where did My Performance Go? (Scaling Visualization in Concurrent C++ Programs)”

High performance is one of the main reasons programmers choose C++ for their applications. If you are writing in C++, odds are you need every bit of computing power your hardware can provide. Today, this means writing multi-threaded programs to effectively utilize the multiple CPU cores that the hardware manufacturers keep adding. Everyone knows that writing multi-threaded programs is hard. Writing correct multi-threaded programs is even harder. Only after spending countless hours debugging race conditions and weird intermittent bugs do many programmers learn that writing efficient multi-threaded programs is harder yet. Have you ever wanted to see what are all your threads doing when they should be busy computing? This talk will show you how. We begin by studying several techniques necessary for collecting large amounts of data from the running program very efficiently, with little overhead and minimal disruption to the program itself. We will cover efficient thread-safe memory management and efficient thread-safe disk I/O. Along the way we dabble in lock-free programming just enough to meet our needs, lest the subject will spiral into an hour-long talk of its own. With all these techniques put together, we can collect information about what each thread is doing, which threads are computing and what exactly, and which threads are slacking off waiting on locks, and do it at the time scale of tens of microseconds if necessary. Then we process the collected data and create a timeline that shows exactly what the program was doing at every moment in time.

 

Łukasz Mendakiewicz: “Viewing the World Through Array-Shaped Glasses”

It’s agreed among experts that the most performant data structure in C++ is an array. Or a vector. Or a dynarray. Indeed, until recently there was no standardized approach in C++ to view these types in a uniform manner. It was even murkier when the data had logically more than one dimension. This talk is an introduction to the new features proposed for C++17 in N3851 bringing all contiguous data into harmony and lifting it to higher dimensions: index, bounds, array_view and more. Attendees will also learn how indexable algorithms differ from the traditional elemental ones, and what does it mean for parallelism.

Speaker’s bio: Łukasz Mendakiewicz is a software engineer at Microsoft, where he focuses on the customer experience with parallel programming models for C++. He is especially interested in GPGPU acceleration, and puts this passion to work on C++ AMP. He holds an M.S. in Computer Science from AGH UST in Krakow, Poland.

Masking a Class in Boost Graph, Part 3: Finding the Path -- Vadim Androsov

Part 3 of Vadim's experience report about using Boost's graph support in an existing game app:

Masking a Class in Boost Graph. Part 3: Finding the Path

by Vadim Androsov

From the article:

In the previous articles of the series we’ve reviewed the adaptive process of the square game field for concepts of boost graphs. Now we’ll consider the process of finding the path in the square field. Implementation of boost search allows adapting the algorithm quite accurately. In this article we’ll provide just one example of such parameterization – an ability to create various lengths of graph edges. ...

Game Changer -- Tony DaSilva

A little more fodder for those still trying to get their management or team to adopt modern C++:

Game Changer

by Tony DaSilva

From the article:

Even though I’m a huge fan of the man, I was quite skeptical when I heard Bjarne Stroustrup enunciate: "C++ feels like a new language". Of course, Bjarne was talking about the improvements brought into the language by the C++11 standard.

Well, after writing C++11 production code for almost 2 years now (17 straight sprints to be exact), I’m no longer skeptical. ... It seems that the authors of the “High Integrity C++” coding standard agree with my assessment. ...

Modernizing Legacy C++ Code -- James McNellis

mcnellis-2014.PNGFrom Techdays 2014 the Netherlands:

Modernizing Legacy C++ Code

by James McNellis

In this session, James McNellis, a developer on the Visual C++ libraries team, will share his experience using elements of modern C++ to improve a large legacy code base. Learn how to apply principles of modern C++ to gradually improve the quality of legacy code and improve maintainability and debuggability

CMake 3.0.0 Released

A new major version of CMake, v3.0.0 has been released. CMake is a tool for cross platform C/C++ (and more) build poject configuration.

Version 3.0.0 contains many improvements. To get an idea of the recent changes, as well as the improvements of CMake over the last months and years, take a look at the following links:

 

EuroLLVM videos and slides now available

eurollvm-2014.PNGAll available videos are now posted from this April's EuroLLVM conference.

The conference included the following C++-related sesssions. Note that only the first two have video, all have slides or other materials.

 

Keynote: What's new in C++14, and how you can take advantage of it (slides) -- Marshall Clow

Portable Native Client. Fast, Secure, Simple: Pick Three. (slides) -- JF Bastien

clang-tidy - Lint-like checks and beyond (slides) -- Daniel Jasper

Refactoring a large C++ codebase using clang (slides) -- Nick Lewycky

Async Magic - std::async in C++ and its consequences for optimizations (slides) -- Tobias Rieger

Intel Clang-Based C++ Compiler (poster) -- Andrey Bokhanko

Clang as a C++ front-end for Frama-C and VeriFast (poster) -- Virgile Prevosto, Franck Védrine, Bart Jacobs and Gijs van Spauwen

IBM XL C/C++ 13.1 supports =default/=delete, constexpr, nullptr

XL C/C++ and AIX and Linux is now available:

XL C/C++ for AIX and Linux, V13.1 Now Released!

We're happy to announce the release of the XL C/C++ for AIX, V13.1 and XL C/C++ for Linux, V13.1 compilers!  The V13.1 release delivers POWER8 exploitation and new compiler and language features.

From the announcement details:

IBM® XL C/C++ for Linux™ is a standards-based, high performance C/C++ compiler with advanced optimizing features. XL C/C++ for Linux, V13.1 delivers a number of new features and enhancements:

  • Exploitation of the latest IBM POWER8™ architecture
  • Support for additional features in C11 and C++11, the current standards for the C and C++ programming languages
  • Partial support for the OpenMP 4.0 industry specification
  • Compile and runtime performance improvements
  • Additional performance options
  • New program diagnostics and error detection features

...

C++11 programming standard

C++11 is the latest standard for the C++ programming language, published as ISO/IEC 14882:2011. With V13.1, partial support for the C++11 standard continues with the implementation of the following features:

Defaulted and deleted functions

This feature introduces two new forms of function declarations to define explicitly defaulted functions and deleted functions. For the explicitly defaulted functions, the compiler generates the default implementations, which are more efficient than manually programmed implementations. The compiler disables the deleted functions to avoid calling unwanted functions.

You can use the -qlanglvl=defaultanddelete option to enable this feature.

Generalized constant expressions

The generalized constant expressions feature extends the set of expressions permitted within constant expressions. The implementation of this feature in XL C/C++ V12.1 was a partial implementation of what is defined in the C++11 standard. In this release, enhancements are made to support user-defined constexpr objects and constexpr pointers or references to constexpr functions and objects.

You can use the -qlanglvl=constexpr option to enable this feature.

The nullptr keyword

This feature introduces nullptr as a null pointer constant. The nullptr constant can be distinguished from integer 0 for overloaded functions. The constants of 0 and NULL are treated as the integer type for overloaded functions, whereas nullptr can be implicitly converted to only the pointer type, pointer-to-member type, and bool type.

You can use the -qlanglvl=nullptr option to enable this feature.

N4058: Atomic Smart Pointers -- Herb Sutter

A new WG21 paper is available. A copy is linked below, and the paper will also appear in the next normal WG21 mailing. If you are not a committee member, please use the comments section below or the std-proposals forum for public discussion.

Document number: N4058

Date: 2014-06-12

Atomic Smart Pointers

by Herb Sutter

Excerpt:

We encourage that modern C++ code should avoid all uses of owning raw pointers and explicit delete. Instead, programmers should use unique_ptr and shared_ptr (with weak_ptr), as this is known to lead to simpler and leak-free memory-safe code. This is especially important when lifetimes are unstructured or nondeterministic, which arises especially in concurrent code, and it has long been well-known that the smart pointers would be useful there; for an example, see [1].

Unfortunately, lock-free code is still mostly forced to use owning raw pointers. Our unique_ptr, shared_ptr, and weak_ptr would directly benefit lock-free code just as they do regular code (see next section), but they are not usable easily or at all in lock-free code because we do not support atomic<unique_ptr<T>>, atomic<shared_ptr<T>>, and atomic<weak_ptr<T>>.

...

If we had atomic<unique_ptr<T>> we could (and should) write the following equivalent code that is safer, no slower, and less error-prone because we can directly express the unique ownership semantics including ownership transfer:

atomic<unique_ptr<X>> p_root;
void producer() {
    auto temp = make_unique<X>();
    load_from_disk_and_store_in( *temp ); // build data structure
    p_root = move(temp);                  // atomically publish it
}
This righteous code should be supported...

CppCon Program Preview, 5 of N -- Boris Kolpackov

cppcon-086.PNG

More CppCon 2014 accepted talks have just been announced, below. For past announcements about the conference program, see also:

Early Bird registration is available until June 30.

 

CppCon Program Preview, 5 of N

by Boris Kolpackov

From the announcement:

Jeff Garland: “Rebuilding Boost Date-Time for C++11”
Kate Gregory and James McNellis: “Making C++ Code Beautiful”
Joel Falcou: “Costless Software Abstractions for Parallel Architectures”
Walter E. Brown: “Your Help Wanted: Language Proposals in Flight”
Jens Weller and Jon Kalb: “Founding C++ User Groups”

 

Jeff Garland: “Rebuilding Boost Date-Time for C++11"

Boost date_time is a widely used C++ library originally released in 2001 — including being the basis for elements of the chrono library in C++11. While the library interface has stayed stable for more than a decade, the world around it has changed with the standard library and language changing. It is time for the library to be rewritten to account for C++11. This lecture describes in detail the design decisions and changes to the library for C++11. More generally it describes elements of design for a small valuetype library. Many of these considerations involve new features of C++11 and how they should be used. This includes noexcept, move construction/assignment (R-values), constexpr, enum classes, and user defined literals. Attendees will learn about the design considerations and tradeoffs of using the new language features in their own work while getting a glimpse of boost date_time version 2.

Speaker’s bio: Jeff Garland has worked on many large-scale, distributed software projects over the past 25+ years. He’s a long time participant in the Boost and C++ community including developing Boost date_time, serving as a moderator and Boost steering committee member, co-authoring papers for the C++11 chrono library, and running the annual Library in a Week workshop at C++Now. Mr. Garland holds a Master’s degree in Computer Science from Arizona State University and a Bachelor of Science in Systems Engineering from the University of Arizona. He is a co-author of “Large Scale Software Architecture: A Practical Guide Using UML.”

 

Kate Gregory and James McNellis: “Making C++ Code Beautiful"

Ask a non-C++ developer what they think of C++ and they’ll give the language plenty of compliments: powerful, fast, flexible, and “the language for smart people”. But along with that you are likely to hear ugly, complicated, hard to read, and “the language for smart people”. Is it possible to write beautiful C++? Not arcanely elegant or wickedly compact, but readable, clear, expressive – beautiful! We say it is, and we want to show you how. In this session, you’ll see how to turn pages of “comic book characters swearing” into code you’ll be proud to call your own. By making your code express your intent, using the power of new language and library functionality, and leaving hard-to-read constructs out of your vocabulary, you can give your code a makeover that will stand the test of time.

Speakers’ bio: Kate Gregory has been using C++ since before Microsoft had a C++ compiler. She writes, mentors, codes, and leads projects, in both C++ and .NET, especially for Windows 7 and 8. Kate is a Microsoft Regional Director, a Visual C++ MVP, and has written over a dozen books (the most recent on C++ AMP for Microsoft Press) and speaks at conferences and user groups around the world. Kate develops courses on C++, Visual Studio, and Windows programming for Pluralsight, founded the East of Toronto .NET Users group, and is a member of adjunct faculty at Trent University in Peterborough.

James McNellis is a senior engineer on the Microsoft Visual C++ team, where he is responsible for the Visual C++ C Runtime (CRT) and C Standard Library implementation. He was previously a member of the Microsoft Expression Blend team, developing the XAML designer tools for Windows 8 apps. Prior to joining Microsoft in 2010, he spent several years working on real-time 3-D simulation and robotics projects in the defense industry. James is a prolific contributor on the Stack Overflow programming Q&A website and occasionally writes for the Visual C++ Team Blog.

 

Joel Falcou: “Costless Software Abstractions for Parallel Architectures"

Performing large, intensive or non-trivial computing on array-like data structures is one of the most common tasks in scientific computing, video game development and other fields. This matter of fact is backed up by the large number of tools, languages and libraries to perform such tasks. If we restrict ourselves to C++-based solutions, more than a dozen such libraries exist from BLAS/LAPACK C++ binding to template meta-programming-based Blitz++ or Eigen. Even if all of these libraries provide good performance or good abstraction, none of them seems to fit the need of so many different user types. Moreover, as parallel system complexity grows, the need to maintain all those components quickly becomes unwieldy. This talk explores various software design techniques, like Generative Programming, Meta Programming and Generic Programming, and their application to the implementation of a parallel computing librariy in such a way that abstraction and expressiveness are maximized while cost over efficiency is minimized. We’ll skim over various applications and see how they can benefit from such tools. We will conclude by discussing what lessons were learnt from this kind of implementation and how those lessons can translate into new directions for the language itself.

Speaker’s bio: Joel Falcou is an assistant professor at the University Paris-Sud and researcher at the Laboratoire de Recherche d’Informatique in Orsay, France. His research focuses on studying generative programming idioms and techniques to design tools for parallel software development. The two main parts of those works are: exploration of Embedded Domain Specific Language design for parallel computing on various architectures and the definition of a formal framework for reasoning about meta-programs and prove their compile-time correctness. Applications range from real-time image processing on embedded architectures to High Performance Computing on multi-core clusters. He is a MetaScale SAS scientific advisor. MetaScale mission is to assist businesses in the exploration and subsequently the mastery of high-performance computing systems.


Walter E. Brown: “Your Help Wanted: Language Proposals in Flight"

Want to collaborate in designing and implementing a new feature for C++17? Then this session is for you! After reviewing the process by which a new C++ feature enters the language, we will look at one or two of the speaker’s proposals that have received early favorable review from the standards committee, and that are awaiting sample implementation and/or formal wording. Attendee feedback will be solicited, and collaborators will be sought to help bring the proposal(s) to fruition.

Speaker’s bio: With broad experience in industry, academia, consulting, and research, Dr. Walter E. Brown has been a C++ programmer for over thirty years, joining the C++ standards effort in 2000. Among numerous other contributions, he is responsible for introducing such now-standard C++ library features as cbegin/cend and common_type as well as headers <random> and <ratio>, and has significantly impacted such core language features as alias templates, contextual conversions, and variable templates. He conceived and served as project editor for the International Standard on Special Mathematical Functions in C++. When not playing with his grandchildren, Dr. Brown is an Emeritus participant in the C++ standards process, with several more core and library proposals under consideration. He was recently appointed an associate project editor for the C++ standard itself.

 

Jens Weller and Jon Kalb: “Founding C++ User Groups"

In September “Meeting C++” will have existed for a little more than 2 years. Within those 2 years we went from a few C++ User Groups in Europe to many. We would like to talk about how to continue with founding even more C++ User Groups, but also sharing an overview of the already active User Groups in Europe and the US.

Speakers’ bio: Jens Weller has worked, since 2007, as a freelancer in C++, specialising in consulting, training and programming C++. He started with programming C++ back in 1998. He is an active member of the European C++ community and the founder of the Meeting C++ platform and conference. Jens is an active supporter of C++ user groups and blogs often about C++.

Jon has been programming in C++ for twenty years. He is currently doing this for Amazon’s A9.com. During the last two decades he has written C++ for Amazon, Apple, Dow Chemical, Intuit, Lotus, Microsoft, Netscape, Sun, Yahoo! and a number of companies that you’ve never heard of. He taught C++ at the graduate school at Golden Gate University for a couple of years and is currently chair of C++ Now (aka BoostCon) and of the Boost Steering Committee. Jon’s current interest is coming up to speed with C++11/14.