Skip to content

Commit

Permalink
Merge pull request #198 from jyoung3131/main
Browse files Browse the repository at this point in the history
Fixes for Getting Started Notebook and Notebook CI Testing
  • Loading branch information
plavin authored Aug 5, 2024
2 parents ad239dd + 3f7467e commit 38abd70
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 16 deletions.
28 changes: 28 additions & 0 deletions .github/workflows/notebooks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Notebook Build

on:
push:
branches:
- 'main'

jobs:
notebook-tests:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.10'

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r notebooks/requirements.txt
#Run the notebook tests with PyTest
- name: Test Getting Started Notebook
run: |
cd notebooks && pytest --nbmake GettingStarted.ipynb
32 changes: 16 additions & 16 deletions notebooks/GettingStarted.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
"outputs": [],
"source": [
"platform_name = 'M1' # Used for plot legends\n",
"system_type = 'cpu' # Change to 'gpu' if you have build a CUDA or OpenCL backend"
"system_type = 'cpu' # Change to 'gpu' if you build with the CUDA backend"
]
},
{
Expand All @@ -69,7 +69,7 @@
"source": [
"## Building\n",
"\n",
"We're going to build the OpenMP backend. You may use a different configure script if you like. If you change the configure script, change `build_dir` accordingly."
"We're going to build the OpenMP backend. You may use a different build option from [Build.md](../Build.md) if you like. If you change the build command, change `build_dir` accordingly."
]
},
{
Expand All @@ -81,11 +81,11 @@
},
"outputs": [],
"source": [
"code_dir = os.path.abspath(os.path.join(os.getcwd(), os.pardir))\n",
"build_dir = f'{code_dir}/build_openmp'\n",
"notebook_dir = os.getcwd()\n",
"configure_script = 'cmake -DBACKEND=openmp -DCOMPILER=gnu -B build_openmp'\n",
"exe = f'{build_dir}/src/spatter-driver'"
"code_dir = os.path.abspath(os.path.join(os.getcwd(), os.pardir))\n",
"build_dir = f'{code_dir}/build_openmp'\n",
"notebook_dir = os.getcwd()\n",
"build_command = 'cmake -DUSE_OPENMP=1 -B build_openmp'\n",
"exe = f'{build_dir}/spatter'"
]
},
{
Expand All @@ -98,7 +98,7 @@
"outputs": [],
"source": [
"os.chdir(code_dir)\n",
"subprocess.run([f'{configure_script}'],shell=True, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL, check=True)\n",
"subprocess.run([f'{build_command}'],shell=True, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL, check=True)\n",
"\n",
"os.chdir(build_dir)\n",
"subprocess.run(['make', '-j4'], stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL, check=True)\n",
Expand Down Expand Up @@ -128,13 +128,13 @@
"metadata": {},
"outputs": [],
"source": [
"N = 8 # Index buffer length, as described above\n",
"index = f'-pUNIFORM:{N}:1' # This is a shorthand that Spatter supports meaning \"Uniform stride, length N, gap 1\n",
" # You could also write -p0,1,2,3,4,5,6,7\n",
"delta = f'-d{N}' # This is the delta applied to the base address between gathers/scatters\n",
"count = f'-l{2**24}' # The -l (--count) option specifies how many gathers or scatters to perform\n",
" # With an index buffer of length 8, and 8 bytes per double, this will be 2^3 * 2^3 * 2^24 = 1GiB of data read\n",
"verbosity = '-v2' # Verbosity level (level >= 2 to print run configs)\n",
"N = 8 # Index buffer length, as described above\n",
"index = f'-pUNIFORM:{N}:1:NR' # This is a shorthand that Spatter supports meaning \"Uniform stride, length N, gap 1, no reuse\n",
" # You could also write -p0,1,2,3,4,5,6,7\n",
"delta = f'-d{N}' # This is the delta applied to the base address between gathers/scatters\n",
"count = f'-l{2**24}' # The -l (--count) option specifies how many gathers or scatters to perform\n",
" # With an index buffer of length 8, and 8 bytes per double, this will be 2^3 * 2^3 * 2^24 = 1GiB of data read\n",
"verbosity = '-v2' # Verbosity level (level >= 2 to print run configs)\n",
"\n",
"_ = subprocess.run([exe, index, delta, count, verbosity], stdout=open('tmp.txt','w'))\n",
"with open('tmp.txt','r') as file:\n",
Expand Down Expand Up @@ -327,7 +327,7 @@
"\n",
"- Dig into other Spatter options in the [README.md](https://github.com/hpcgarage/spatter#readme)\n",
"\n",
"- Capture app patterns for your app with our [DyanamoRIO tracing tool](https://github.com/hpcgarage/dr-gather-scatter-trace). (Note: This tool isn't quite ready to generate JSON input for Spatter. Let us know if you're intested in using it!)\n",
"- Capture app patterns for your app with our [GS_Patterns tracing tool](https://github.com/hpcgarage/gs_patterns).\n",
"\n",
"- See more experiments in our [paper](https://dl.acm.org/doi/abs/10.1145/3422575.3422794)\n",
"\n",
Expand Down
2 changes: 2 additions & 0 deletions notebooks/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ mistune==3.0.2
nbclient==0.10.0
nbconvert==7.16.4
nbformat==5.10.4
nbmake
nest-asyncio==1.6.0
notebook_shim==0.2.4
numpy==1.26.4
Expand All @@ -71,6 +72,7 @@ pure-eval==0.2.2
pycparser==2.22
Pygments==2.18.0
pyparsing==3.1.2
pytest
python-dateutil==2.9.0.post0
python-json-logger==2.0.7
pytz==2024.1
Expand Down

0 comments on commit 38abd70

Please sign in to comment.