Skip to content

num.threads not respected by ranger::ranger function #339

Description

@alexzwanenburg

I implemented the ranger::ranger function within a loop that is externally parallelised (using parallel::parLapply). To avoid competition across processes, I set num.threads to 1. However, each process is still attempting to maximise CPU use, which indicates that more than one thread is created.

When I disable external parallelisation, ranger still tries to maximise CPU use, despite num.threads=1.

My call to the ranger::ranger function is shown below:

model_obj      <- ranger::ranger(formula, data=dt,
                                     num.trees = 2^param$n_tree,
                                     sample.fraction = param$sample_size,
                                     mtry = ceiling(param$m_try*length(feature_cols)),
                                     min.node.size = param$node_size,
                                     alpha = param$alpha,
                                     splitrule = param$split_rule,
                                     importance = vimp_method,
                                     probability = fit_probability,
                                     num.threads = 1)

In the above code snippet, param is a list with model hyper-parameters, and vimp_method and fit_probability are likewise provided. These parameters should not affect threading.

I tried num.threads=1L, but this did not have any different effect.

The operating system is Windows 7 SP1 Build 7601, running on Intel i7-3770 CPU with 4 (8) cores and 32 GB of RAM. The version of Ranger is 0.10.1, with R 3.5.0.

If I am missing something obvious please let me know.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions