cms icon indicating copy to clipboard operation
cms copied to clipboard

Add a setting for multithreading

Open cargaji opened this issue 1 year ago • 3 comments

Is your feature request related to a problem? Please describe. Some programs, such as Python with the numpy library, make use of multiple threads by default. isolate can be configured to allow or disallow the creation of threads.

The current behaviour is that languages that "require multithreading", such as Java and C# (Mono) are allowed an unlimited number of threads, and all others are limited to a single thread. Additionally, whenever one of the multithreaded languages are enabled in a contest, multithreading is enabled for all languages in that contest.

Describe the solution you'd like A setting to indicate the level of multithreading allowed. This could be as simple as a global value for all contests (in cms.conf, which in turn is passed to isolate), or as complex as a per-task or per-contest (even per-contest and language) setting.

Describe alternatives you've considered

  • In the case of numpy, it can be configured to use a single thread.
  • Alternatively, CMS can be edited (specifically language.py#requires_multithreading) and recompiled, but this would require a redeployment of the system.
  • Either Java (JDK) or C# (Mono) can be enabled in a contest (even if the contestants should or won't use it), then multithreading is enabled for all submissions, even those that do not require multithreading.

cargaji avatar Jul 12 '24 10:07 cargaji

I don't think that there is any reason for not enabling multithreading everywhere.

gollux avatar Jul 13 '24 10:07 gollux

Technically it is significantly harder for C++ competitive programmer to implement multithreading, and multithreading is in general not supported by official olympiad competitions. Therefore, I do support this issue!

snowynguyen avatar Aug 05 '24 13:08 snowynguyen

Do you see any advantage that using multithreading would give to contestants? Remember that time limit in CMS applies to the sum of running times of all processes and threads spawned by the solution.

Re competitions: For example, current IOI rules allow multithreading.

gollux avatar Aug 07 '24 16:08 gollux