CUDA C++ Programming Guide PG-02829-001_v11.2|xvi
L.1.4.GPU Memory Oversubscription..................................................................................... 340
L.1.5.Multi-GPU....................................................................................................................... 340
L.1.6.System Allocator............................................................................................................ 341
L.1.7.Hardware Coherency......................................................................................................341
L.1.8.Access Counters.............................................................................................................342
L.2.Programming Model.............................................................................................................343
L.2.1.Managed Memory Opt In............................................................................................... 343
L.2.1.1.Explicit Allocation Using cudaMallocManaged().................................................... 343
L.2.1.2.Global-Scope Managed Variables Using __managed__........................................ 344
L.2.2.Coherency and Concurrency......................................................................................... 344
L.2.2.1.GPU Exclusive Access To Managed Memory......................................................... 345
L.2.2.2.Explicit Synchronization and Logical GPU Activity.................................................346
L.2.2.3.Managing Data Visibility and Concurrent CPU + GPU Access with Streams........ 347
L.2.2.4.Stream Association Examples................................................................................ 348
L.2.2.5.Stream Attach With Multithreaded Host Programs...............................................348
L.2.2.6.Advanced Topic: Modular Programs and Data Access Constraints......................349
L.2.2.7.Memcpy()/Memset() Behavior With Managed Memory.......................................... 350
L.2.3.Language Integration..................................................................................................... 351
L.2.3.1.Host Program Errors with __managed__ Variables..............................................351
L.2.4.Querying Unified Memory Support................................................................................352
L.2.4.1.Device Properties.....................................................................................................352
L.2.4.2.Pointer Attributes.................................................................................................... 352
L.2.5.Advanced Topics............................................................................................................. 352
L.2.5.1.Managed Memory with Multi-GPU Programs on pre-6.x Architectures...............352
L.2.5.2.Using fork() with Managed Memory....................................................................... 353
L.3.Performance Tuning............................................................................................................. 353
L.3.1.Data Prefetching.............................................................................................................354
L.3.2.Data Usage Hints........................................................................................................... 355
L.3.3.Querying Usage Attributes.............................................................................................356