Code Monkey home page Code Monkey logo

m3's Introduction

M3: Memory Map Manager for NVIDIA GPUs

Overview

M3 allows multiple processes to share a memory region in NVIDIA GPU. Any POSIX process can use M3 API which requests server to allocate or share a memory region. UNIX domain sockets are used to implement IPC between M3 server and client processes. To ensure the consistency of IPC, a semaphore file is used to "lock" the IPC socket.

M3 Server

A single line of code is enough to boot M3 server;

auto m3Srv = MemMapManger::Instance();

The server class is implemented in singleton pattern, thus every call of Instance() will return the identical instance.

M3 APIs

Currently, M3 supports APIs below:

RequestRegister

MemMapManager::RequestRegister(ProcessInfo &pInfo, int sock_fd);

Registers client process info to M3 server. The process info is passed by argument pInfo.

This API is left for future use. The list of subscribers can be used for access control, request validation, etc.

RequestRoundedAllocationSize

MemMapManager::RequestRoundedAllocationSize(ProcessInfo &pInfo, int sock_fd, size_t num_bytes);

Get allocation size, rounded up by minimum memory granularity.

CUDA environment has a minimum granularity size whicih is determined by device. If we try to allocate a memory region whose size is not a multiple of the granularity, CUDA APIs may throw an error.

It is the M3 server that determines which GPU device to allocate memory, minimum granularity should be obtained from server.

User MUST call this API before calling MemMapManager::RequestAllocate().

RequestAllocate

MemMapManager::RequestAllocate(ProcessInfo &pInfo, int sock_fd, char * memId, size_t alignment, size_t num_bytes);

Allocate a memory region in GPU device.

memId works as a hint for memory reuse. If M3 server finds a memory region which is tagged with the same memId, the region is not allocated redundantly. Instead, a handler to the region is passed to the client. The client uses the handler to map the region into its own virtual address space.

To Do

  • Support multiple GPU - This feature requires P2P communication between GPUs using NVLINK, which my PC doesn't support yet.
  • Refactor ProcessInfo class

Notes

m3's People

Contributors

seungpyo avatar

Stargazers

이준열 avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.