Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add gnn dataset download script #570

Merged
merged 2 commits into from
Nov 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 46 additions & 0 deletions script/get-dataset-mlperf-inference-gnn/_cm.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
alias: get-dataset-mlperf-inference-gnn
automation_alias: script
automation_uid: 5b4e0237da074764
cache: true
tags:
- get
- dataset
- mlperf
- gnn
- icbh
- inference
uid: 824e61316c074253
# new_env_keys:
input_mapping:
out_path: CM_IGBH_DATASET_OUT_PATH
deps:
- tags: mlperf,inference,source
names:
- inference-src
- tags: get,python
names:
- get-python
variations:
debug:
default: true
group: dataset-type
env:
CM_IGBH_DATASET_TYPE: debug
CM_IGBH_DATASET_SIZE: tiny
full:
group: dataset-type
env:
CM_IGBH_DATASET_TYPE: full
CM_IGBH_DATASET_SIZE: full
glt:
env:
CM_IGBH_GRAPH_COMPRESS: yes
csc:
group: compressed-layout
default: true
env:
CM_IGBH_GRAPH_COMPRESS_LAYOUT: csc
csr:
group: compressed-layout
env:
CM_IGBH_GRAPH_COMPRESS_LAYOUT: csr
49 changes: 49 additions & 0 deletions script/get-dataset-mlperf-inference-gnn/customize.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
from cmind import utils
import os

def preprocess(i):

os_info = i['os_info']

env = i['env']

if os_info['platform'] == "windows":
return {'return':1, 'error': 'Script not supported in windows yet!'}

print("Using MLCommons Inference source from '" + env['CM_MLPERF_INFERENCE_SOURCE'] +"'")

#run cmd
run_cmd = ""
graph_folder = os.path.join(env['CM_MLPERF_INFERENCE_SOURCE'], 'graph', 'R-GAT')

download_loc = env.get('CM_IGBH_DATASET_OUT_PATH', os.getcwd())

run_cmd += f"cd {graph_folder} "
x_sep = " && "

# download the model
if env['CM_IGBH_DATASET_TYPE'] == "debug":
run_cmd += x_sep + env['CM_PYTHON_BIN_WITH_PATH'] + f" tools/download_igbh_test.py --target-path {download_loc}"
else:
run_cmd += x_sep + f"./tools/download_igbh_full.sh {download_loc}"

# split seeds
run_cmd += x_sep + f"{env['CM_PYTHON_BIN_WITH_PATH']} tools/split_seeds.py --path {download_loc} --dataset_size {env['CM_IGBH_DATASET_SIZE']}"

# compress graph(for glt implementation)
if env.get('CM_IGBH_GRAPH_COMPRESS', '') == "yes":
run_cmd += x_sep + f"{env['CM_PYTHON_BIN_WITH_PATH']} tools/compress_graph.py --path {download_loc} --dataset_size {env['CM_IGBH_DATASET_SIZE']} --layout {env['CM_IGBH_GRAPH_COMPRESS_LAYOUT']}"

env['CM_RUN_CMD'] = run_cmd

return {'return':0}

def postprocess(i):

env = i['env']

env['CM_IGBH_DATASET_PATH'] = env.get('CM_IGBH_DATASET_OUT_PATH', os.getcwd())

print(f"Path to the IGBH dataset: {os.path.join(env['CM_IGBH_DATASET_PATH'], env['CM_IGBH_DATASET_SIZE'])}")

return {'return':0}
24 changes: 24 additions & 0 deletions script/get-dataset-mlperf-inference-gnn/run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/bin/bash

#CM Script location: ${CM_TMP_CURRENT_SCRIPT_PATH}

#To export any variable
#echo "VARIABLE_NAME=VARIABLE_VALUE" >>tmp-run-env.out

#${CM_PYTHON_BIN_WITH_PATH} contains the path to python binary if "get,python" is added as a dependency



function exit_if_error() {
test $? -eq 0 || exit $?
}

function run() {
echo "Running: "
echo "$1"
echo ""
eval "$1"
exit_if_error
}

run "$CM_RUN_CMD"
Loading