I apologize if this has already been asked, but I read a bunch of documentation and still do not know how to do what I would like to do.
I would like to run a Python script through several cores at the same time.
I have 1800 .h5 files in a directory with the names "snaphots_s1.h5", "snapshots_s2.h5", etc., each about 30 MB in size. This Python script:
- Reads h5py files from one directory.
- Retrieves and processes the data in the h5py file.
- Creates graphs of the extracted data.
Once this is done, the script will then read in the next h5py file from the directory and follow the same procedure. Therefore, none of the processors should exchange data with others, performing this work.
The script looks like this:
import h5py
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.colors as colors
import cmocean
import os
from mpi4py import MPI
de.logging_setup.rootlogger.setLevel('ERROR')
count = 1
for filename in os.listdir('directory'):
with h5py.File('directory/{}'.format(filename),'r') as file:
...
...
count = count + 1
, mpi4py ( ), , multiprocessing.Pool( . ).
, : script mpi4py? , , script?