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