{"id":16716,"date":"2016-11-13T15:51:18","date_gmt":"2016-11-13T13:51:18","guid":{"rendered":"http:\/\/hgpu.org\/?p=16716"},"modified":"2016-11-13T15:51:18","modified_gmt":"2016-11-13T13:51:18","slug":"cuda-api-wrappers-thin-c-flavored-wrappers-for-the-cuda-runtime-api","status":"publish","type":"post","link":"https:\/\/hgpu.org\/?p=16716","title":{"rendered":"CUDA-API-wrappers: Thin C++-flavored wrappers for the CUDA runtime API"},"content":{"rendered":"<p>nVIDIA&#8217;s Runtime API for CUDA is intended for use both in C and C++ code. As such, it uses a C-style API, the lower common denominator (with a few notable exceptions of templated function overloads).<\/p>\n<p>This library of wrappers around the Runtime API is intended to allow us to embrace many of the features of C++ (including some C++11) for using the runtime API &#8211; but without reducing expressivity or increasing the level of abstraction (as in, e.g., the Thrust library). Using cuda-api-wrappers, you still have your devices, streams, events and so on &#8211; but they will be more convenient to work with in more C++-idiomatic ways.<\/p>\n<p>&nbsp;<\/p>\n<p><strong>Key features<\/strong><\/p>\n<ul>\n<li>All functions and methods throw exceptions on failure &#8211; no need to check return values (the exceptions carry the status information).<\/li>\n<li>Judicious namespacing (and some internal namespace-like classes) for better clarity and for semantically grouping related functionality together.<\/li>\n<li>There are proxy objects for devices, streams, events and so on, using RAII to relieve you of remembering to free or destroy resources.<\/li>\n<li>Various Plain Old Data structs adorned with convenience methods and operators.<\/li>\n<li>Aims for clarity and straightforwardness in naming and semantics, so that you don&#8217;t need to refer to the official documentation to understand what each class and function do.<\/li>\n<li>Thin and lightweight:<br \/>\nNo work done behind your back, no caches or indices or any such thing.<br \/>\nNo costly inheritance structure, vtables, virtual methods and so on &#8211; vanishes almost entirely on compilation<br \/>\nDoesn&#8217;t &#8220;hide&#8221; any of CUDA&#8217;s complexity or functionality; it only simplifies use of the Runtime API.<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>nVIDIA&#8217;s Runtime API for CUDA is intended for use both in C and C++ code. As such, it uses a C-style API, the lower common denominator (with a few notable exceptions of templated function overloads). This library of wrappers around the Runtime API is intended to allow us to embrace many of the features of [&hellip;]<\/p>\n","protected":false},"author":769,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[89,3],"tags":[14,20,176],"class_list":["post-16716","post","type-post","status-publish","format-standard","hentry","category-nvidia-cuda","category-paper","tag-cuda","tag-nvidia","tag-package"],"views":2389,"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/hgpu.org\/index.php?rest_route=\/wp\/v2\/posts\/16716","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/hgpu.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/hgpu.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/hgpu.org\/index.php?rest_route=\/wp\/v2\/users\/769"}],"replies":[{"embeddable":true,"href":"https:\/\/hgpu.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=16716"}],"version-history":[{"count":2,"href":"https:\/\/hgpu.org\/index.php?rest_route=\/wp\/v2\/posts\/16716\/revisions"}],"predecessor-version":[{"id":16718,"href":"https:\/\/hgpu.org\/index.php?rest_route=\/wp\/v2\/posts\/16716\/revisions\/16718"}],"wp:attachment":[{"href":"https:\/\/hgpu.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=16716"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/hgpu.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=16716"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/hgpu.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=16716"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}