eljost / pysisyphus

Python suite for optimization of stationary points on ground- and excited states PES and determination of reaction paths.
GNU General Public License v3.0
99 stars 35 forks source link

Suppress printing/file i/o option #285

Closed ncasetti7 closed 10 months ago

ncasetti7 commented 10 months ago

Hi devs,

I was wondering if it would be possible to add an option to optimizers/interpolators (or maybe there is an option and I'm just not seeing it) to avoid printing/writing to files. I've been using pysisyphus with a neural network potential, and I'm trying to get some speedup by parallelizing with multiprocessing, but I'm running into issues with race conditions. It would be very convenient to turn off all file i/o and printing.

Thanks in advance!

eljost commented 10 months ago

Dear Nicholas,

thanks for your interest in pysisyphus. Currently, this is not possible. I made some changes to the Optimizer base-class on the dev-branch to control printing better, but this is not yet merged into master.

What do you mean with race-conditions and supressing file I/O? Regarding the latter there is also some progress on the dev-branch where for example only the files of the previous/latest calculation can be kept.

Do you use multiprocessing in one pysisyphus-process or do you run multiple pysisyphus-processes in parallel?

It seems possible to suppress STDOUT in multiprocessing, as described https://stackoverflow.com/a/66266293.

ncasetti7 commented 10 months ago

Thanks for the quick response! It turns out there was a bug on my end so I'm seeing the speed up I was expecting now (and suppressing STDOUT is a functional strategy), but it would definitely be convenient to choose to avoid making files and printing so I look forward to the next version! I was running multiple pysisyphus processes in parallel which resulted in a lot of file overwriting (which doesn't particularly matter in my case because I don't pull any information from the written files), and I thought this may have been a bottleneck. Fortunately, this wasn't the case as I found a small bug in the way I was creating the processes.