Paper - IDAV: Institute for Data Analysis and Visualization
Paper - IDAV: Institute for Data Analysis and Visualization
Paper - IDAV: Institute for Data Analysis and Visualization
You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
12 · Lefohn, Kniss, Strzodka, Sengupta, <strong>and</strong> Owens<strong>and</strong> the corresponding C++ code is:✞AddrTransType::gpu_range r = addrTrans.gpu_range( vec4i(0,0,0,0), vec4i(5,5,5,5) );☎// ... Bind Glift parameters ...// ... Bind Cg shader ...exec_gpu_iterators(r);✝✆3.5 Container AdaptorsContainer adaptors are higher-level containers that define a behavior atop an existing VirtMem structure. For example,the ArrayGpu template class shown in the example at the beginning of Section 3 is a simple container adaptorbuilt atop the set of typedefs developed in the preceding sections:✞☎typedef PhysMemGPUPhysMemType;typedef NdTo2dAddrTransGPU AddrTransType;typedef VirtMemGPU VirtMemType;✝✆The ArrayGpu container adaptor encapsulates this definition such that users can declare an array simply as:✞typedef glift::ArrayGpu ArrayType;✝Section 6 describes more complex container adaptors.4. GLIFT DESIGN AND IMPLEMENTATIONThe Glift C++ template library maps the abstractions described in Section 2 to a C++/OpenGL/Cg GPU programmingenvironment. This section describes the design <strong>and</strong> implementation of Glift, including how Glift unifies the CPU <strong>and</strong>GPU source code, adds template support to Cg, <strong>and</strong> virtualizes the multi-processor, multi-language GPU memorymodel.To support the design goals of the abstraction presented in Section 2, the implementation of Glift is designed withthe following goals:—incremental adoption;—extensibility;—efficiency; <strong>and</strong>—CPU <strong>and</strong> GPU interoperability.Glift supports easy, incremental adoptability by providing familiar texture-like <strong>and</strong> STL-like interfaces, requiringminimal changes to shader authoring <strong>and</strong> compilation pipelines, <strong>and</strong> allowing Glift components to be used alone orin combination with others. Glift offers easy extensibility by providing three ways to create new, fully-virtualizedGlift data structures: write a new address translator, change the behavior of an existing Glift component by writinga new policy 3 , or write a container adaptor that maps new behavior atop an existing structure. Glift’s efficiencymechanisms include static polymorphism, template specialization, program specialization, <strong>and</strong> leveraging optimizingGPU compilers. Lastly, Glift supports processor interoperability by supporting CPU <strong>and</strong> GPU memory mappings <strong>and</strong>iterators.☎✆3 Policy-based template design factors classes into orthogonal components, making it possible to change behavior by replacing one small module[Alex<strong>and</strong>rescu 2001]ACM Transactions on Graphics, Vol. 25, No. 1, January 2006.