CppCon Program Preview, 4 of N -- Boris Kolpackov

cppcon-093.PNG

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

Super Early Bird registration has sold out, but Early Bird registration is available until June 30.

 

CppCon Program Preview, 4 of N

by Boris Kolpackov

From the announcement:

Alisdair Meredith: “What’s New In The C++14 Library”
Hartmut Kaiser: “Asynchronous Computation in C++”
Eric Niebler: “Range-ifying the STL”
Michael Wong: “What did C++ do for Transactional Memory?”
John Lakos: “Defensive Programming Done Right”

 

Alisdair Meredith: “What’s New In The C++14 Library"

After the grand expansion of the C++11 library, the extensions in C++14 are more modest, often tweaking and cleaning up existing components. Alisdair Meredith, the Library Working Group chair, walks through all these changes and additions, and a little insight into features that did not make the cut, and are expected to arrive in other Technical Specification before the next standard ships.

Speaker’s bio: Alisdair Meredith is a software developer at BloombergLP in New York, and the C++ Standard Committee Library Working Group chair. He has been an active member of the C++ committee for just over a decade, and by a lucky co-incidence his first meeting was the kick-off meeting for the project that would become C++11, and also fixed the contents of the original library TR. He is currently working on the BDE project, BloombergLP’s open source libraries that offer a foundation for C++ development, including a standard library implementation supporting the polymorphic allocator model proposed for standardization.

 

Hartmut Kaiser: “Asynchronous Computation in C++"

With the adoption of the new C++11 Standard the community sees a revival of interest in the language. This interest is also driven by the demands that new computer architectures and technologies are exerting on application developers and domain scientists. Especially the need for highly runtime adaptive algorithms and applications puts a great strain on our ability to efficiently write code which performs well and which scales satisfactory, as multi-core and multi-threading is the new modality of computation. We argue that new programming models have to be developed if we are to gain continued scalability of computations as we increase the size of our systems. These are programming models which work equally well for inter-node as well for intra-node use. With the degree of complexity and size increasing in new hardware architectures, applications are more and more hindered by the main bottlenecks in computation, namely starvation, latency, overheads, and waiting for contention resolution. We present HPX, which is a general purpose parallel C++ runtime system implementing a new model of computation -- ParalleX, that attempts to address those challenges. We show results from using HPX for leveraging and managing asynchrony, overlapping different phases of computation and communication, suggesting ways to seamlessly expose it to programmers in an easy to use way.

Speaker’s bio: Hartmut is a member of the faculty at the CS department at Louisiana State University (LSU) and a senior research scientist at LSU’s Center for Computation and Technology (CCT). He received his doctorate from the Technical University of Chemnitz (Germany) in 1988. He is probably best known through his involvement in open source software projects, mainly as the author of several C++ libraries he has contributed to Boost, which are in use by thousands of developers worldwide. His current research is focused on leading the STE||AR group at CCT working on the practical design and implementation of future execution models and programming methods. His research interests are focused on the complex interaction of compiler technologies, runtime systems, active libraries, and modern system’s architectures. His goal is to enable the creation of a new generation of scientific applications in powerful, though complex environments, such as high performance computing, distributed and grid computing, spatial information systems, and compiler technologies.

 

Eric Niebler: “Range-ifying the STL"

Range-based interfaces have many advantages over iterator-based ones. That explains why there are several range libraries to choose from. The standardization committee has been hard at work exploring the range library design space, and with luck we’ll have a best-of-breed solution ready for C++17. In this talk, I will present the work of several committee members, myself included, to put together a range library suitable for standardization. The work condenses the ideas from several popular range libraries, some new ideas, and much guidance from SG9, the Ranges Study Group. Come find out how we’re planning to make the STL easier to use, more powerful, and even more efficient than it already is, while keeping everything you already love.

Speaker’s bio: Eric Niebler is a true believer in the power of low-overhead abstraction and a shameless bit-twiddler, which explains his deep and abiding love of C++. Before setting out on his own as a freelancer, Eric worked as a consultant for BoostPro, a library developer for Visual C++, and a systems developer in Microsoft Research. He has authored 4 official Boost libraries, is on the Boost Steering Committee, and is a member of the C++ Standardization Committee. Eric lived for over 2 years years with no fixed address, slinging code from the coffee shops of the world. Buy him a beer and ask him about his life as a tech-nomad.

 

Michael Wong: “What did C++ do for Transactional Memory?"

SG5 is a Study Group within WG21 developing a promising new way to deal with mutable shared memory, that is expected to be more usable and scalable than current techniques based on atomics and mutexes. It promises to be as easy to use as coarse-grained locks, as scalable as fine-grained locks and yet remain composable. Find out where on the Gartner hype cycle lives Transactional Memory. Is it at the Peak of Inflated Expectations, Trough of Disillusionment, Slope of Enlightenment, or Plateau of Productivity? For that matter, just how soon will I be able to use it with the new Intel Haswell, and IBM Power Hardware, or is it one of those mirages where the closer you get to your hardware, the further it moves away. And is it true that one of the lead author of this TM proposal also wrote “Is it just a Research Toy?” This 60-90 minute advanced talk will cover the history of Transactional Memory, various lock elision and optimistic speculation techniques, the technical engine behind Transactional Memory, the recent research in its use cases, usability and performance data that supports its entry into the C++ Standard, and of course the latest details of the SG5 Technical Specification, including our effort at transactionalizing the C++ Standard Library.

Speaker’s bio: Michael Wong is the CEO of the OpenMP Corporation, a consortium of 26 member companies that hold the de-facto standard for parallel programming specification for C/C++ and FORTRAN. He is the IBM and Canadian Head of delegation to the C++ Standard, and Chair of the WG21 Transactional Memory group. He is the co-author of a number of C++/OpenMP/TM features and patents. He is the past C++ team lead to IBM´s XL C++ compiler, C compiler and has been designing C++ compilers for twenty years. Currently, he is leading the C++11 deployment as a senior technical lead for IBM. His current research interest is in the area of parallel programming, C++ benchmark performance, object model, generic programming and template metaprogramming. He is a frequent speaker at various technical conferences and serves on the Programming Committee of Boost, and IWOMP. He holds a B.Sc from University of Toronto, and a Masters in Mathematics from University of Waterloo.

 

John Lakos: “Defensive Programming Done Right“

In our component-based development methodology, each developer is responsible for ensuring that the software he or she creates is easy to understand and use, and not especially easy to misuse. One common form of misuse is to invoke a library function or method under circumstances where not all of its preconditions are satisfied, leading to undefined behavior. Contracts having undefined behavior are not necessarily undesirable, and (for many engineering reasons) are often optimal. Most would agree that a well-implemented library should do something other than silently continue when a pre-condition violation is detected, although these same folks might not agree on what specific action should be taken. Unfortunately, validating preconditions implies writing additional code that will execute at runtime. More code runs slower, and some would fairly argue that they should not be forced to pay for redundant runtime checks in the library software they use. Whether and to what extent library functions should validate their preconditions, and what should happen if a precondition violation is detected are questions that are best answered on an application by application basis -- i.e., by the owner of main. “Defensive Programming Done Right” makes it all possible. In this talk, we begin by reviewing the basic concepts of Design-By-Contract (DbC), and what we mean by the term “Defensive Programming” (DP). We then explore our overall approach to institutionalizing defensive programming in robust reusable library software such that each application can conveniently specify both the runtime budget (e.g., none, some, lots) for defensive checking, and also the specific action to be taken (e.g., abort, throw, spin) should a precondition violation occur. Along the way, we touch on how modern compilers and linkers work, binary compatibility, and the consequences of possibly violating the one-definition rule in mixed-mode builds. We conclude the talk by describing and then demonstrating our “negative testing” strategy (and supporting test apparatus) for readily verifying, in our component-level test drivers, that our defensive checks detect and report out-of-contract client use as intended. Actual source for the supporting utility components will be presented throughout the talk and made available afterwards.

Speaker’s bio: John Lakos, author of “Large Scale C++ Software Design,” serves at Bloomberg LP in New York City as a senior architect and mentor for C++ Software Development world-wide. He is also an active voting member of the C++ Standards Committee, Library Working Group. Previously, Dr. Lakos directed the design and development of infrastructure libraries for proprietary analytic financial applications at Bear Stearns. For 12 years prior, Dr. Lakos developed large frameworks and advanced ICCAD applications at Mentor Graphics, for which he holds multiple software patents. His academic credentials include a Ph.D. in Computer Science (’97) and an Sc.D. in Electrical Engineering (’89) from Columbia University. Dr. Lakos received his undergraduate degrees from MIT in Mathematics (’82) and Computer Science (’81). His next book, entitled “Large-Scale C++, Volume I: Process and Architecture,” is anticipated in 2014.

C++ User Group Meetings in June

Again, the monthly overview on the C++ User Group Meetings

C++ User Group Meetings in June

by Jens Weller

The complete list:

  • 11.6 C++ UG San Francisco/Bayarea - "Good enough" is good enough! by Alex Martelli
  • 12.6 C++ UG Dresden - Uniforme Initialisierung
  • 12.6 C++ UG Dutch/Amsterdam - Concurrency in C++11
  • 17.6 C++ UG Berlin - Template Metaprogramming for numerical problems
  • 18.6 C++ UG NRW/Düsseldorf - Drawing with Cairo
  • 18.6 C++ UG Northwest/Seattle - High Reliability Systems
  • 21.6 C++ UG Russia/St. Petersburg
  • 25.6 C++ UG Hamburg - Code Dojo
  • 26.6 C++ UG Munich - boost.asynchronous
  • 28.6 C++ UG Italy/Milano

Videos from C++ track on NDC Oslo

ndc-2014.pngThere was a very strong C++ track on NDC Oslo this year. Here is an overview of the videos recorded for the C++ track:

Day 1, June 4, 2014

  • C++14, Nico Josuttis (video)
  • Effective Modern C++, Scott Meyers (video)
  • Error Handling in C++, Andrei Alexandrescu (video)
  • Move, noexcept, and push_back(), Nico Josuttis (video)
  • C++ Type Deduction and Why You Care, Scott Meyers (video)
  • Generic and Generative Programming in C++, Andrei Alexandrescu (video)

Day 2, June 5, 2014

  • C++ -- where are we headed?, Hubert Matthews (video)
  • Three Cool Things about D, Andrei Alexandrescu (video)
  • The C++ memory model, Mike Long (video, slides)
  • C++ for small devices -- Isak Styf (video)
  • Brief tour of Clang, Ismail Pazarbasi (video)
  • Insecure coding in C and C++, Olve Maudal (video, slides)
  • So you think you can int? (C++), Anders Knatten (video)

Enjoy!

NDC Oslo is an annual conference for programmers (~1600 delegates). 2 days of preconference courses/workshops, and then 9 tracks of technology talks for 3 days. The dates for 2015 are June 15-19. There will be a strong C++ track next year as well. Save the dates and stay tuned.

Generator functions in C++ -- Paolo Severini

Paolo Severini expands the concept of resumable functions to support generator functions, providing the ability of lazily producing the values in a sequence only when they are needed.

Generator functions in C++

by Paolo Severini

From the article:

In the previous post we had a look at the proposal of introducing resumable functions into the C++ standard to support writing asynchronous code modeled on the C# async/await pattern.

We saw that it is already possible to experiment with the future resumable and await keywords in Visual Studio, by installing the latest November 2013 CTP. But the concept of resumable functions is not limited to asynchrony; in this post we’ll see how it can be expanded to support generator functions.

Generator functions and lazy evaluation

In several languages, like C# and Python, generator functions provide the ability of lazily producing the values in a sequence only when they are needed. ...

Masking a Class in Boost.Graph -- Vadim Androsov

Here's an experience report about using Boost's graph support in an existing game app, with some notes about Boost Concepts:

Masking a Class in Boost Graph. Part 1: Let the Interface Be

Masking a Class in Boost Graph. Part 2: Completing the Implementation of Concept Support

by Vadim Androsov

From the articles:

I had to rebuild a pathfinding algorithm for our game recently. The previous one (Boost Concepts) was bad as any sidestep was dangerous. So I wanted to take a ready algorithm from a good source. That’s exactly when I remembered about boost as there’s functionality for working with graphs. Unfortunately “find a function, call it and everything will work” approach wasn’t meant to be realized. The library is focused on the maximum use flexibility which has badly affected its simplicity. But it’s better than creating it from scratch (then fixing it). I didn’t want to bother with other libraries, while boost has already been used in the project. ...

N4056: Minimal incomplete type support for standard containers -- Zhihao Yuan

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: N4056

Date: 2014-05-23

Minimal incomplete type support for standard containers

by Zhihao Yuan

Excerpt:

In the previous version (N3890) of this paper, we explored the possibility to make all STL containers usable in the recursive data structure definitions, such as

struct Entry
{
    std::list<Entry> messages;
    // ...
};

Based on the discussion on the Issaquah meeting, we achieved the consensus to processed with the approach – “Containers of Incomplete Types”, but limit the scope to std::vector, std::list, and std::forward_list, as the first step.

Are lists evil? -- Bjarne Stroustrup

Recently added to Bjarne Stroustrup's FAQ:

Are lists evil?

by Bjarne Stroustrup

From the FAQ:

According to some corners of the Web, I am under the impression that vectors are always better than linked lists and that I don't know about other data structures, such as trees (e.g. std::set) and hash tables (e.g., std::unordered_map). Obviously, that's absurd.

The problem seems to be an interesting little exercise that John Bentley once proposed to me: Insert a sequence of random integers into a sorted sequence, then remove those elements one by one as determined by a random sequece of positions: Do you use a vector (a contiguously allocated sequence of elements) or a linked list? For example, see Software Development for Infrastructure. I use this example to illustrate some points, encourage thought about algorithms, data structures, and machine architecture, concluding:

  • don't store data unnecessarily,
  • keep data compact, and
  • access memory in a predictable manner.

Note the absence of "list" and "vector" in the conclusion. Please don't confuse an example with what the example is meant to illustrate.

I used that example in several talks, notably:

This video has been popular: It has been downloaded more than 250K times (plus another 50K+ times at verious other sites). My impression is that many viewers failed to understand that the purpose of that example is to illustrate some general principles and to make people think. Initially, most people say ``List of course!'' (I have tried asking that question many times) because of the many insertions and deletions ``in the middle'' (lists are good at that). That answer is completely and dramatically wrong, so it is good to know why.

I have been using the example for years, and had graduate students implement and measure dozens of variants of this exercise and different exercises. Examples and measurements by others can be found on the Web. Of course,

  • I have tried maps (they are much better than lists, but still slower than vectors)
  • I have tried much larger elements sizes (eventually lists come into their own)
  • I have used binary search and direct insertion for vectors (yes, they speed up even further)
  • I checked my theory (no I'm not violating any big-O complexity rule; it is just that some operations can be dramatically more expensive for one data structure compared to another)
  • I have preallocated links (that's better than std::list but the traversal still kills performance)
  • I have used singly-linked lists, forward_lists, (that doesn't make much difference, but makes it a bit harder to ensure that the user code is 100% equivalent)
  • I know (and say) that 500K lists are not common (but that doesn't matter for my main point). We use many structures (large and small) where there is a choice between linked and contiguous reprentation.
  • I know that for insertion push_front() is faster for std::lists and push_back()s is faster for vectors. You can construct examples to illustrate that, but this example is not one of those.

My point is not about lists as such. They have their uses, but this example isn't one of them. Please don't confuse the example with what the example is used to illustrate. This example is about use of memory: We very often create a data structure, do some computation on it requiring access (often, traversal), and then delete it. The ordered sequence is simply an example of such use and the example is presented to get people to think about what matters in such cases. My suggestion is:

  • don't store data unnecessarily,
  • keep data compact, and
  • access memory in a predictable manner.

I emphasize the importance of cache effects. In my experience, all but true experts tend to forget those when algorithms are discussed.

And, yes, my recomendation is to use std::vector by default. More generally, use a contiguous representation unless there is a good reason not to. Like C, C++ is designed to do that by default.

Also, please don't make statements about performance without measurements. I have seen a case where changing a zero-to-two-element list to a zero-to-two-element vector made a factor-of-two difference to an algorithm. I didn't expect that. Nor did other experts looking at the code.

N3995: A proposal to add shared_mutex (untimed) (Revision 2) -- Gor Nishanov

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: N3995

Date: 2014-05-20

A proposal to add shared_mutex (untimed) (Revision 2)

by Gor Nishanov

Excerpt:

This revision is a minor edit of an earlier paper N3961 that clarifies that proposed modifications to the standard be incorporated into the Concurrency Technical Specification N3993.

CppCon Program Preview, 3 of N -- Boris Kolpackov

cppcon-093.PNG

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

Super Early Bird registration has sold out, but Early Bird registration is available until June 30.

 

CppCon Program Preview, 3 of N

by Boris Kolpackov

From the announcement:

Herb Sutter: “Standardization Update: C++14 and the Seven Dwarfs”
Stephan T. Lavavej: “STL Features And Implementation Techniques”
Jared Hoberock: “Parallelizing the Standard Algorithms Library”
Howard Hinnant: “Types Don’t Know #”
Lisa Lippincott: “How to call C libraries from C++”

 

Herb Sutter: “Standardization Update: C++14 and the Seven Dwarfs"

Standardization has accelerated: By the time we meet at CppCon, C++14 might already be ratified. But that’s only one of eight (so far) work items now in flight. In this session, the chair of the ISO C++ committee will give a brief summary of the new features coming in C++14 itself, and then a tour of the seven (7) near-term separate Technical Specifications already underway — think of these as the “C++14 wave” of deliverables. The ISO C++ committee has transitioned to a “decoupled” model where updated versions of the standard are published more frequently, while at the same time major pieces of work can progress and be published independently from the Standard itself and delivered asynchronously in the form of Technical Specifications (TS’s) that are separate from the main Standard and can later be incorporated into the Standard. Come to this session to see how this is helping both the standard and C++ compiler implementations near you stay current with the latest in C++.

Speaker’s bio: Herb Sutter is the author of several best-selling books about C++, chair of the ISO C++ standards committee, and a software architect at Microsoft.

 

Stephan T. Lavavej: “STL Features And Implementation Techniques"

This session will cover selected STL features from C++11/14, both explaining how to use them and delving into implementation techniques that could be useful outside the STL. I will avoid covering popular features you’re already using (e.g. make_shared, make_unique) and obscure features of limited use (e.g. forward_list). The focus will be on useful but underappreciated features like dual-range algorithms, minimal allocators, and heterogeneous associative lookup.

Speaker’s bio: Stephan T. Lavavej is a Senior Developer at Microsoft. Since 2007, he’s worked with Dinkumware to maintain Visual C++’s implementation of the C++ Standard Library. He also designed a couple of C++14 features: make_unique and the transparent operator functors. He likes his initials (which people can actually spell) and cats (although he doesn’t own any).

 

Jared Hoberock: “Parallelizing the Standard Algorithms Library"

Until recently, C++ programmers building parallel programs found little support for parallelism in the standard toolbox. That’s changing with the technical specification on Extensions for Parallelism in C++. This talk will explore how programmers can build portable parallel programs from high-level parallel algorithms which can execute on CPU threads, vector units, and even GPUs.

Speaker’s bio: Jared Hoberock is a research scientist at NVIDIA where he develops the Thrust parallel algorithms library and edits the Technical Specification on Extensions for Parallelism for C++.

 

Howard Hinnant: “Types Don’t Know #“

This presentation will be based on the C++ standards committee proposal of a new hashing infrastructure that completely decouples hashing algorithms from individual types that need to be hashed. This decoupling divides the hashing computation among 3 different programmers who need not coordinate with each other:

  1. Authors of hashable types (keys of type K) write their hashing support just once, using no specific hashing algorithm. This code resembles (and is approximately the same amount of work as) operator== and swap for a type.
  2. Authors of hashing algorithms write a functor (e.g. H) that operates on a contiguous chunk of generic memory, represented by a void const* and a number of bytes. This code has no concept of a specific key type, only of bytes to be hashed.
  3. Clients who want to hash keys of type K using hashing algorithm H will form a functor of type std::uhash<H> to give to an unordered container: unordered_set<K, uhash<H>>

Speaker’s bio: Howard Hinnant is a lead author of several C++11 features including: move semantics, unique_ptr, <mutex>, <condition_variable> and <chrono>. Coming in C++14: <shared_mutex>. Howard is also a lead author on two open source projects: a std::lib implementation and an Itanium ABI implementation.

 

Lisa Lippincott: “How to call C libraries from C++“

Many libraries used by C++ programs present C-like interfaces that are compatible with C++, but are not directly compatible with good C++ style. Using these libraries directly is error-prone in many of the ways C++ is designed to avoid. It is better to pass through an interface layer that presents good C++ style on the C++ side. But writing such an interface layer is daunting. Completing it may be an enormous task, as are documenting it and maintaining it as the underlying library evolves. To address this problem, I will present a style of writing such interfaces that can be used incrementally as needed, and that reduces documentation cost. I will also present a small library that supports the writing of interface layers in this style.

Speaker’s bio: Lisa Lippincott is a Chief Software Architect at Tanium, a bay-area startup. Her claim to fame is writing one phrase appearing in the C++ standard. In her spare time, she studies mathematical logic with a category-theoretic approach.

Schedule for Meeting C++ 2014 released

I have the honor to annouce the release of the schedule for this years Meeting C++ conference:

Meeting C++ 2014 Schedule

This years conference offers again few highlights and a lot of great C++ content. The keynotes will be given by Scott Meyers and Hartmut Kaiser. The conference will offer 21 Talks in 3 Tracks.