mirror of
				https://github.com/bspeice/speice.io
				synced 2025-11-04 02:20:36 -05:00 
			
		
		
		
	Start on notebook
This commit is contained in:
		
							
								
								
									
										69
									
								
								_notebooks/2022-10-15-multicast/Multicast.ipynb
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										69
									
								
								_notebooks/2022-10-15-multicast/Multicast.ipynb
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,69 @@
 | 
			
		||||
{
 | 
			
		||||
 "cells": [
 | 
			
		||||
  {
 | 
			
		||||
   "cell_type": "markdown",
 | 
			
		||||
   "id": "2bfdffd8",
 | 
			
		||||
   "metadata": {},
 | 
			
		||||
   "source": [
 | 
			
		||||
    "# No More Magic: A Practical Introduction to Multicast\n",
 | 
			
		||||
    "\n",
 | 
			
		||||
    "Recent interaction - had a networking issue, likely required configuration tweaking, but:\n",
 | 
			
		||||
    "\n",
 | 
			
		||||
    "- Not a lot of people who knew how to diagnose\n",
 | 
			
		||||
    "- Training people to diagnose is challenging\n",
 | 
			
		||||
    "\n",
 | 
			
		||||
    "I've said that [High Performance Systems aren't magical](/2019/07/high-performance-systems.html), but realization that for many topics, accessibility is problematic. If I _wanted_ to know more, I don't have any meaningful way to investigate beyond asking for someone's time. While manager's judgment call is fine (\"this isn't worth investigating further\"), I've had a lot of career \"upskilling\" learned from open source. Want to make sure that if other people are interested, there's a way to meaningfully engage with the topic."
 | 
			
		||||
   ]
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
   "cell_type": "markdown",
 | 
			
		||||
   "id": "d8cee425",
 | 
			
		||||
   "metadata": {},
 | 
			
		||||
   "source": [
 | 
			
		||||
    "Add links for:\n",
 | 
			
		||||
    "- Notebook source\n",
 | 
			
		||||
    "- Script for running the notebook"
 | 
			
		||||
   ]
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
   "cell_type": "code",
 | 
			
		||||
   "execution_count": 3,
 | 
			
		||||
   "id": "2edfbd79-d246-4b9a-a4a3-8e383c6b22a1",
 | 
			
		||||
   "metadata": {},
 | 
			
		||||
   "outputs": [],
 | 
			
		||||
   "source": [
 | 
			
		||||
    "#include <cstdlib>\n",
 | 
			
		||||
    "#include <thread>\n",
 | 
			
		||||
    "#include <vector>\n",
 | 
			
		||||
    "\n",
 | 
			
		||||
    "auto run_parallel(std::initializer_list<const char*> commands) {\n",
 | 
			
		||||
    "    \n",
 | 
			
		||||
    "}\n",
 | 
			
		||||
    "\n",
 | 
			
		||||
    "std::vector<std::thread> threads{};\n",
 | 
			
		||||
    "\n",
 | 
			
		||||
    "for (auto command : commands)\n",
 | 
			
		||||
    "    threads.emplace_back([=]() { std::system(command); });\n",
 | 
			
		||||
    "\n",
 | 
			
		||||
    "for (auto& thread : threads)\n",
 | 
			
		||||
    "    thread.join();"
 | 
			
		||||
   ]
 | 
			
		||||
  }
 | 
			
		||||
 ],
 | 
			
		||||
 "metadata": {
 | 
			
		||||
  "kernelspec": {
 | 
			
		||||
   "display_name": "C++17",
 | 
			
		||||
   "language": "C++17",
 | 
			
		||||
   "name": "xcpp17"
 | 
			
		||||
  },
 | 
			
		||||
  "language_info": {
 | 
			
		||||
   "codemirror_mode": "text/x-c++src",
 | 
			
		||||
   "file_extension": ".cpp",
 | 
			
		||||
   "mimetype": "text/x-c++src",
 | 
			
		||||
   "name": "c++",
 | 
			
		||||
   "version": "17"
 | 
			
		||||
  }
 | 
			
		||||
 },
 | 
			
		||||
 "nbformat": 4,
 | 
			
		||||
 "nbformat_minor": 5
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										24
									
								
								_notebooks/2022-10-15-multicast/run.sh
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										24
									
								
								_notebooks/2022-10-15-multicast/run.sh
									
									
									
									
									
										Executable file
									
								
							@ -0,0 +1,24 @@
 | 
			
		||||
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
 | 
			
		||||
mkdir -p "$SCRIPT_DIR"/notebook
 | 
			
		||||
 | 
			
		||||
# Package pinning because of https://github.com/jupyter-xeus/xeus-cling/issues/415
 | 
			
		||||
read -r -d '' RUN <<EOF
 | 
			
		||||
    apt update \
 | 
			
		||||
 && apt install -y \
 | 
			
		||||
        iperf3 \
 | 
			
		||||
        sudo \
 | 
			
		||||
        strace \
 | 
			
		||||
 && chown \$MAMBA_USER:\$MAMBA_USER /notebook \
 | 
			
		||||
 && sudo -u \$MAMBA_USER micromamba -y -n base install -c conda-forge \
 | 
			
		||||
        jupyterlab \
 | 
			
		||||
        xeus-cling==0.13.0 \
 | 
			
		||||
        libstdcxx-devel_linux-64==9.4.0 \
 | 
			
		||||
        libgcc-devel_linux-64==9.4.0 \
 | 
			
		||||
 && sudo -u \$MAMBA_USER micromamba run jupyter-lab /notebook
 | 
			
		||||
EOF
 | 
			
		||||
 | 
			
		||||
# --net=host: Docker networking doesn't do multicast, use host networking so the
 | 
			
		||||
#   local router handles it instead.
 | 
			
		||||
# --user=root: Install iperf3/strace
 | 
			
		||||
podman run --net=host --user=root --rm --volume "$SCRIPT_DIR"/notebook:/notebook:Z -it mambaorg/micromamba bash -c "$RUN"
 | 
			
		||||
    
 | 
			
		||||
		Reference in New Issue
	
	Block a user