cjlin1 / simpleNN

BSD 3-Clause "New" or "Revised" License
48 stars 16 forks source link

Add an option to limit the CPU usage #2

Open djshen opened 4 years ago

djshen commented 4 years ago

We can add a command line option to adjust the CPU usage, so that the program won't use up all of the resources. In addition, one can compare the timing of different settings.

parser.add_argument('--num_threads', dest='num_threads', type=int, default=0)

sess_config.inter_op_parallelism_threads = args.num_threads
sess_config.intra_op_parallelism_threads = args.num_threads
quanpr commented 4 years ago

Hi,

Thank you for posting this issue. May I ask what is the situation of adding this feature to limit CPU usage?

djshen commented 4 years ago

In the slides of project 1, the instructor suggests discussing the running time. I think it is reasonable to fix the number of cores over the experiments. However, I may run other programs at the same time due to research or other courses. In this case, I can't expect the numbers of cores using by different runs are the same. If this is not a common situation, please just ignore the feature request. Thank you!

quanpr commented 4 years ago

I see. Thanks for the suggestions. I am not sure whether we should add this. After all, it's not very common except for teaching purposes.

cjlin1 commented 4 years ago

for any timing exp it's better to use a machine without other jobs..

On 2020-03-07 21:41, djshen wrote:

In the slides of project 1, the instructor suggests discussing the running time. I think it is reasonable to fix the number of cores over the experiments. However, I may run other programs at the same time due to research or other courses. In this case, I can't expect the numbers of cores using by different runs are the same. If this is not a common situation, please just ignore the feature request. Thank you!

-- You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub [1], or unsubscribe [2]. [ { "@context": "http://schema.org", "@type": "EmailMessage", "potentialAction": { "@type": "ViewAction", "target": "https://github.com/cjlin1/simpleNN/issues/2?email_source=notifications\u0026email_token=ABI3BHW7KS4RSLFQR5TP3ELRGJFKHA5CNFSM4LDMGJYKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEODZXQQ#issuecomment-596089794", "url": "https://github.com/cjlin1/simpleNN/issues/2?email_source=notifications\u0026email_token=ABI3BHW7KS4RSLFQR5TP3ELRGJFKHA5CNFSM4LDMGJYKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEODZXQQ#issuecomment-596089794", "name": "View Issue" }, "description": "View this Issue on GitHub", "publisher": { "@type": "Organization", "name": "GitHub", "url": "https://github.com" } } ]

Links:

[1] https://github.com/cjlin1/simpleNN/issues/2?email_source=notifications&email_token=ABI3BHW7KS4RSLFQR5TP3ELRGJFKHA5CNFSM4LDMGJYKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEODZXQQ#issuecomment-596089794 [2] https://github.com/notifications/unsubscribe-auth/ABI3BHTX3ASGMFV4CTNGKIDRGJFKHANCNFSM4LDMGJYA

djshen commented 4 years ago

OK. I agree that it is better to keep this project as simple as possible. Thank you!

djshen commented 4 years ago

I find that in project 3 we may need this feature to limit tensorflow to use single thread.