Skip to content

Commit

Permalink
Fixed installation and dependency
Browse files Browse the repository at this point in the history
- added a main function to be called from setup bin
- removed explicit dependency
- added pip install in setup.py
- added readme to documentation
  • Loading branch information
hariharan-devarajan committed Aug 12, 2022
1 parent c916e83 commit 37b032f
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 19 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ pip install dlio_benchmark
Otherwise, you can also install from source by running (from source folder):
```bash
python setup.py install
# this install dlio_benchmark as an executable.
dlio_benchmark -h
```
On Theta
```bash
Expand Down
10 changes: 1 addition & 9 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,9 @@ package_dir =
= src
packages = find:
python_requires = >=3.6
install_requires =
absl-py
horovod[tensorflow]>=0.19.5
tensorflow>=2.2.0
numpy>=1.19.1
h5py~=2.10.0
pandas>=1.1.3
mpi4py>=3.1.3
[options.packages.find]
where = src

[options.entry_points]
console_scripts =
executable-name = dlio_benchmark
dlio_benchmark = dlio_benchmark:main
3 changes: 3 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,6 @@

conf_dict = read_configuration("./setup.cfg")
setup(**conf_dict['metadata'])

import os
os.system("pip install -r ./requirements.txt")
29 changes: 19 additions & 10 deletions src/dlio_benchmark.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,21 @@
You should have received a copy of the GNU General Public License along with this program.
If not, see <http://www.gnu.org/licenses/>.
"""
from time import sleep,time
from time import sleep, time

from src.common.enumerations import Profiler
from src.data_generator.generator_factory import GeneratorFactory
from src.reader.reader_factory import ReaderFactory
from src.profiler.profiler_factory import ProfilerFactory
from src.utils.argument_parser import ArgumentParser
import tensorflow as tf

tf.compat.v1.logging.set_verbosity(tf.compat.v1.logging.ERROR)
import horovod.tensorflow as hvd
import math
import os
import shutil

hvd.init()


Expand All @@ -33,14 +35,16 @@ def barrier():
const = tf.constant(1)
reduced = hvd.allreduce(const)

def model(epoch,step, time):

def model(epoch, step, time):
sleep(time)


class DLIOBenchmark(object):
"""
The Benchmark represents the I/O behavior of deep learning applications.
"""

def __init__(self):
"""
This initializes the DLIO benchmark. Intialization includes:
Expand Down Expand Up @@ -120,9 +124,7 @@ def _checkpoint(self, step_number):
f.close()
pass



def _train(self,epoch_number):
def _train(self, epoch_number):
"""
Training loop for reading the dataset and performing training computations.
:return: returns total steps.
Expand Down Expand Up @@ -150,13 +152,16 @@ def run(self):
self.reader_handler.read(epoch_number)
barrier()
if self.arg_parser.args.my_rank == 0:
print("Datasets loaded in {} epochs for rank {} in {} seconds".format(epoch_number + 1, self.arg_parser.args.my_rank,(time() - start_time)))
print("Datasets loaded in {} epochs for rank {} in {} seconds".format(epoch_number + 1,
self.arg_parser.args.my_rank,
(time() - start_time)))
start_time = time()
steps = self._train(epoch_number)
barrier()
if self.arg_parser.args.my_rank == 0:
print("Finished {} steps in {} epochs for rank {} in {} seconds".format(steps, epoch_number + 1,
self.arg_parser.args.my_rank,(time() - start_time)))
self.arg_parser.args.my_rank,
(time() - start_time)))
self.reader_handler.finalize()

def finalize(self):
Expand All @@ -181,14 +186,18 @@ def finalize(self):
#


if __name__ == '__main__':
"""
The main method to start the benchmark runtime.
def main():
"""
The main method to start the benchmark runtime.
"""
os.environ["DARSHAN_DISABLE"] = "1"
benchmark = DLIOBenchmark()
benchmark.initialize()
benchmark.run()
benchmark.finalize()
barrier()


if __name__ == '__main__':
main()
exit(0)

0 comments on commit 37b032f

Please sign in to comment.