Giter VIP home page Giter VIP logo

Comments (4)

athas avatar athas commented on June 2, 2024 1

I propose two new C API functions:

void futhark_context_config_set_max_memory_unused(const char *space, int64_t bytes);
void futhark_context_config_set_max_memory_usage(const char* space, int64_t bytes);

The former function limits how many unused bytes are allowed to be in the free list(s), and the latter how many may be allocated total (actually there will be some fine print regarding CPU memory in particular, as that is difficult to count when stack-allocating). The space argument is used to indicate which memory space we are considering (e.g. you can limit GPU memory without limiting CPU memory). We could ditch that for simplicity, and then the limit would apply generally to all memory spaces.

from futhark.

athas avatar athas commented on June 2, 2024

I'm not completely sure what you are asking for. There are two ways you can limit memory:

  1. Put an upper bound on how much free memory the Futhark runtime system is allowed to keep in the free list.
  2. Put an upper bound on how much memory Futhark is allowed to allocate in total.

Option (1) means a Futhark program can still eat up all the system memory, but option (2) means programs might unexpectedly fail.

I guess both are useful in different circumstances.

from futhark.

FluxusMagna avatar FluxusMagna commented on June 2, 2024

I was primarily thinking of total memory, but for my purposes either would be sufficient. If I could only choose one of them, 1 seems more flexible, in the sense that the same setting could be used for any program without causing any crashes. Option 2 does seem attractive in the context of sharing hardware though.

I'm also a bit curious how limiting the memory use could affect performance if there is sufficient L3-cache to store all necessary data. Could limiting the total memory use to below the size of the cache actually improve performance by reducing cache misses?

from futhark.

athas avatar athas commented on June 2, 2024

If you limit the total memory usage, it just means more programs will fail with OOM errors. It will not affect the performance of programs that actually run. The only point where Futhark makes decisions based on memory availability is when it manages the free list.

from futhark.

Related Issues (20)

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.