-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/dev' into dev
- Loading branch information
Showing
1 changed file
with
44 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 | ||
``` | ||
|
||
|
@@ -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() | ||
``` |