Freeing up the threads for multi-threading

I use IJulia for interactive programming. I usually start with

julia> using IJulia
julia> notebook()

From there I get a Jupyter environment where I can run programs like those given here Parallel loops · FLoops. The program runs well as I can confirm from the system monitor /task manager. However, the threads remain engaged even when the programs are done executing. Is there any way to free up the threads when execution is done? something like delete (gcp('nocreate')) as in Matlab? Thank you for your help

What you mean by the threads remaining engaged? Having the threads available to the Julia process impairs you from doing anything else?

I appreciate your interest in solving my issue. Even if the program is executed, I see the system running as shown in the picture below. I have to restart the machine to relax the cores I need to use for other computations.

Even if you kill the julia process?

Even if I killed all of the app processes including Julia.

That is very strange. Are you sure the problem is related to Julia? Is it possible for you to provide some information about the actual code you are running?

run top to see if it’s Julia using the CPUs?

1 Like

This is definitely not normal behavior. What does top say as Jling suggested?

I am very certain that it is Julia. Before running the Julia CPU usage profiles are very low and some of them are never used since I have 64 of them. After I multi-thread and execute the program, most(all) of CPUs get engaged but won’t get relaxed when done. I am running different metaheuristics algorithms (such as GA, DE, PSO etc) for some combinatorial optimization problems. The actual code is a bit long and hasn’t been uploaded to any internet platforms yet, my sincere apologies. Thanking you.

Thank you for your interest in solving this issue. Please help me more with this top. How and where do I accomplish this? Do I run this on terminal?

These are incompatible. If julia is killed, it can not be what is taking up your threads. So either you aren’t killing it, or something else is taking up your CPU.

1 Like

top is a tool which is on most linux systems which lets you see which processes are using the most resources like CPU, RAM etc. There’s also htop which is the same information, presented a bit nicer but you usually have to install it.

Yes, you run it from the terminal and Ctrl+C to stop.

1 Like

Are you only using multithreading in your code? This should be lightweight and you shouldn’t have to kill anything to clean it up.

Are you using multiprocessing at all? Like with addprocs (Distributed.jl), or do any packages use multiple processes?