Behavior of max_calls of @ray.remote by default

I am currently running into some OOM issues on my GPU. I later found out that this bug boils down to max_calls parameter for my actor.
I wonder what is the default value of max_calls if no parameters are specified. By this I mean, say

@ray.remote
def some_fn():
    ...

In the official doc ray==2.5.0, it says, by default, num_gpus will be set to 0. And I also notice that max_calls will be default to 1 to prevent GPU memory leakage only if num_gpus>0. Can I interpret this as if no parameters are specified in @ray.remote, then max_calls will be configured as infinite, which is default if only num_cpus are positive.

Another related question is, in doc of .options() method, it says overriding max_calls is not allowed. I wonder can we set max_calls=1 in .options() for the case I just mentioned. And what is the rationale behind this design: does not support overwriting max_calls
Thanks in advance :slight_smile:

Hi, max_calls by default is 0, which means, infinity. For GPU tasks (num_gpus != 0), by default, it’s 1.

The doc means, if you have already got a remote function, and you want to override that later, it’s not allowed.

For example,

@ray.remote
def f():
  ...

f.options(max_calls=2) # not valid since the function's meta has been registered when it's defined.
1 Like