Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/dev' into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
hariharan-devarajan committed Aug 11, 2023
2 parents ee87cc9 + 6866374 commit 9aa91fc
Showing 1 changed file with 44 additions and 13 deletions.
57 changes: 44 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ Requirements
1. Python > 3.8
2. spack

Install dependencies
Using spack dlio-profiler
```
git clone [email protected]:hariharan-devarajan/dlio-profiler.git
cd dlio-profiler
spack env activater -p ./dependency
spack env create -d ./spack-env
spack env activate -p ./spack-env
spack add [email protected]
spack install
```

Expand Down Expand Up @@ -42,22 +42,53 @@ Usage
import dlio_profiler_py as logger
from time import sleep
import os
cwd = os.getcwd()
def custom_events():
logger.start("test", "cat2")
args = {
"epoch": 1,
"index": 1,
}
start = logger.get_time()
sleep(2)
logger.stop()
end = logger.get_time()
logger.log_event("test", "cat2", start, end - start, int_args=args)
def posix_calls1():
f = open(f"{cwd}/data/demofile2.txt", "w+")
def posix_calls1(index):
path=f"{cwd}/data/demofile{index}.txt"
f = open(path, "w+")
f.write("Now the file has more content!")
f.close()
def posix_calls2():
f = open(f"{cwd}/data/demofile2.txt", "r")
data = f.read()
f.close()
import numpy as np
def posix_calls2(index):
#print(f"{cwd}/data/demofile2.npz")
path = f"{cwd}/data/demofile{index}.npz"
if os.path.exists(path):
os.remove(path)
records = np.random.randint(255, size=(8, 8, 1024), dtype=np.uint8)
record_labels = [0] * 1024
np.savez(path, x=records, y=record_labels)
import threading
posix_calls1()
logger.initialize(f"{cwd}/log.pwf", f"{cwd}/data")
t1 = threading.Thread(target=posix_calls1, args=(10,))
custom_events()
t2 = threading.Thread(target=posix_calls2, args=(1,))
t3 = threading.Thread(target=posix_calls2, args=(2,))
# starting thread 1
t1.start()
t2.start()
t3.start()
t1.join()
t2.join()
t3.join()
logger.finalize()
```

0 comments on commit 9aa91fc

Please sign in to comment.