You can make a difference in the Apple Support Community!

When you sign up with your Apple Account, you can provide valuable feedback to other community members by upvoting helpful replies and User Tips.

Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

Utilize full potential of CPU

Is it possible to utilize the full potential of a CPU?

I am coding in R (based on Xcode) and it takes a long time to compile my scripts, while my CPU is only at a stable 10%-level according to the activity monitor. Any solution to utilize the CPU to speed up the processes?


(MacBook Pro 15" Mid 2018 - 2,2 GHz 6-Core Intel Core i7 - 16 GB 2400 MHz DDR4 - Radeon Pro 555X 4 GB)

MacBook Pro

Posted on Mar 4, 2021 1:07 PM

Reply
Question marked as Top-ranking reply

Posted on Mar 5, 2021 6:20 AM

<< Do you know how to “prioritize” a program, such that it uses multiple cores at same time in order to achieve the fastest possible compile time? >>


Turning what is inherently a single-threaded process (compiling) into a multi-threaded process for an arbitrary number of processors is a classic unsolved problem in Computer Science.


You are already using CPU at the maximum possible rate, with the exception of idle time spent waiting for I/O.


--------

Although my suggestions above may have seemed oblique to your issue at the time, improving I/O speed will cause less idle time, waiting for I/O to complete, and indirectly increase processor utilization.

4 replies
Question marked as Top-ranking reply

Mar 5, 2021 6:20 AM in response to nielsen8000

<< Do you know how to “prioritize” a program, such that it uses multiple cores at same time in order to achieve the fastest possible compile time? >>


Turning what is inherently a single-threaded process (compiling) into a multi-threaded process for an arbitrary number of processors is a classic unsolved problem in Computer Science.


You are already using CPU at the maximum possible rate, with the exception of idle time spent waiting for I/O.


--------

Although my suggestions above may have seemed oblique to your issue at the time, improving I/O speed will cause less idle time, waiting for I/O to complete, and indirectly increase processor utilization.

Mar 4, 2021 1:25 PM in response to nielsen8000

As you know, compiling is a mostly a compute process, but can also be slowed by having to read your input files and write your results files. or by limited RAM memory. Also, any other processes running at the same time, such as a Browser open in the background, can slow the amount of processing power available.


If you are running any tasks that scan files, such as Virus scanners, or non-Mac-Native apps that Sync files, such as DropBox or Onedrive, these may also limit performance.


Video editors have learned that having Sources on one drive, Destinations on another drive, and making certain that neither of those is the SYSTEM drive produces the fastest elapsed times.

Mar 4, 2021 3:20 PM in response to Grant Bennet-Alder

Thank you for the suggestions. To clarify my question; my programming software is the only running program, and my computer is only using a fraction of the power. Hence, I was looking for suggestions on how to increase the CPU usage in order to speed up the process. Thereby, the problem is not related to limited performance of the CPU since there is 90% available capacity.


Do you know how to “prioritize” a program, such that it uses multiple cores at same time in order to achieve the fastest possible compile time?

Mar 5, 2021 10:00 AM in response to Grant Bennet-Alder

Once again, thank you for your reply. I am aware of the bottleneck related single-threaded process, but thanks for the elaboration, which helped me clearing out for my thoughts.


The reason I posted this question was the idea in this article (https://www.techrepublic.com/article/how-to-adjust-cpu-priority-using-apples-terminal/), where it is suggested to use the terminal. Unfortunately, I could not figure out how to utilize this approach (no improvements in idle time). Therefore, I tried to reach out on this forum, but your replies confirmed my initial thoughts, so I will try to utilize another approach.

Utilize full potential of CPU

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.