{"id":24912374,"url":"https://github.com/jamesnulliu/learning-programming-massively-parallel-processors","last_synced_at":"2026-05-06T18:37:40.226Z","repository":{"id":268591526,"uuid":"902150236","full_name":"jamesnulliu/Learning-Programming-Massively-Parallel-Processors","owner":"jamesnulliu","description":"Leaning notes of Programming Massively Parallel Processors, 4-th edition.","archived":false,"fork":false,"pushed_at":"2025-03-09T16:30:34.000Z","size":132,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-28T04:18:42.507Z","etag":null,"topics":["cuda","notes","pytorch"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jamesnulliu.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-12-12T02:20:35.000Z","updated_at":"2025-03-09T16:30:37.000Z","dependencies_parsed_at":"2025-02-12T18:26:04.414Z","dependency_job_id":"17cae57c-5bd6-410e-bfb6-e11794adc16a","html_url":"https://github.com/jamesnulliu/Learning-Programming-Massively-Parallel-Processors","commit_stats":null,"previous_names":["jamesnulliu/learn-programming-massively-parallel-processors","jamesnulliu/learning-programming-massively-parallel-processors"],"tags_count":0,"template":false,"template_full_name":"jamesnulliu/VSC-Python-Project-Template","purl":"pkg:github/jamesnulliu/Learning-Programming-Massively-Parallel-Processors","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jamesnulliu%2FLearning-Programming-Massively-Parallel-Processors","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jamesnulliu%2FLearning-Programming-Massively-Parallel-Processors/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jamesnulliu%2FLearning-Programming-Massively-Parallel-Processors/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jamesnulliu%2FLearning-Programming-Massively-Parallel-Processors/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jamesnulliu","download_url":"https://codeload.github.com/jamesnulliu/Learning-Programming-Massively-Parallel-Processors/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jamesnulliu%2FLearning-Programming-Massively-Parallel-Processors/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266143941,"owners_count":23883069,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cuda","notes","pytorch"],"created_at":"2025-02-02T05:19:26.451Z","updated_at":"2026-05-06T18:37:40.171Z","avatar_url":"https://github.com/jamesnulliu.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\n\u003ch1\u003eLearning \u003ci\u003eProgramming Massively Parallel Processors\u003c/i\u003e\u003c/h1\u003e\n\u003cimg alt=\"C++20\" src=\"https://img.shields.io/badge/C%2B%2B-20-blue?style=plastic\u0026logo=cplusplus\u0026logoColor=blue\"\u003e \u003cimg alt=\"CUDA-12\" src=\"https://img.shields.io/badge/CUDA-12-green?style=plastic\u0026logo=nvidia\"\u003e \u003cimg alt=\"Static Badge\" src=\"https://img.shields.io/badge/python-3-blue?style=plastic\u0026logo=python\u0026logoColor=blue\"\u003e \u003cimg alt=\"Static Badge\" src=\"https://img.shields.io/badge/pytorch-2-orange?style=plastic\u0026logo=pytorch\"\u003e\n\u003c/div\u003e\n\n## 1. Environment\n\n### 1.1. Method 1: Use Docker Image\n\nThe simplest way is to use my docker image [jamesnulliu/deeplearning:latest](https://hub.docker.com/r/jamesnulliu/deeplearning) which contains all the softwares you need to build the project:\n\n```bash\ndocker pull jamesnulliu/deeplearning:latest\n```\n\n\u003e Check my blog: [Docker Container with Nvidia GPU Support](https://jamesnulliu.github.io/blogs/docker-container-with-nvidia-gpu-support) if you need any help.\n\n### 1.2. Method 2: Setup Environment Manually\n\nOr if you are planing to setup your own environment, here are some tips:\n\nYou should install all the softwares with corresponding versions listed bellow:\n\n- Miniconda/Anaconda\n- gcc \u003e= 12.0, nvcc \u003e= 12.0\n- CMake \u003e= 3.30\n- Ninja\n- vcpkg, pkg-config\n- [managed by conda] python \u003e= 3.10, pytorch \u003e= 2.0\n- [managed by vcpkg] cxxopts, fmt, spdlog, proxy, gtest, yaml-cpp\n\n**🎯Miniconda**\n\nManaging python environments with miniconda is always a good choice. Check [the official website](https://www.anaconda.com/docs/getting-started/miniconda/install#quickstart-install-instructions) for an installation guide.\n\nAfter installation, if you do not intend to install all the packages in `base` environment, create a new conda environment named `PMPP` (or whatever you like) and activate it:\n\n```bash {linenos=true}\n# python version should be larger than 3.10\nconda create -n PMPP python=3.12\nconda activate PMPP  # Activate this environment\n# In my experience, when your system gcc version is larger than 12, it is\n# highly possible that you have to update libstd++ in conda for running the\n# later compiled targets. All you need to do is to run this command:\nconda upgrade libstdcxx-ng -c conda-forge\n```\n\n**🎯PyTorch**\n\nInstall pytorch **with pip (not conda)** in environment `PMPP` following the steps on [the official website](https://pytorch.org/get-started/locally/#start-locally). In my case I installed `torch-2.6.0 + cuda 12.6`.\n\n\u003e 📝**NOTE**  \n\u003e All the python packages you installed can be found under the directory of `$CONDA_PREFIX/lib/python3.12/site-packages`.\n\n**🎯CUDA**\n\nTo compile cuda code, you need to install **cuda toolkit** on your system. Usually, even if `torch-2.6.0 + cuda 12.6` is installed in your conda environment while `cuda 12.1` is installed on the system, you can run torch in python without any mistakes. But in some cases, you still have to install `cuda 12.6` to exactly match the torch you chose.\n\nYou can find all versions of cuda on [the official website](https://developer.nvidia.com/cuda-toolkit-archive).\n\n\u003e 📝**NOTE**  \n\u003e Installing and using multiple versions of cuda is possible by managing the `PATH` and `LD_LIBRARY_PATH` environment variables on linux, and you can do this manually or refering to my methods in [this blog](/blogs/environment-variable-management).\n\n## 2. Quick Start\n\nTo build the C++ part only:\n\n```bash\nbash scripts/build.sh\n```\n\n\u003e 📝**NOTE**  \n\u003e See \"[cmake-parameters.md](csrc/cmake/cmake-parameters.md)\" for details about setting up the build process.\n\nYou will find \"./build/lib/libPmppTorchOps.so\" which is the operator library and \"./build/test/pmpp_test\" which is the test executable (with gtest).\n\nExecute the test executable to test the library manually:\n\n```bash\n./build/test/pmpp_test\n```\n\nNote that the test is already integrated into CMake build system (with ctest); In \"[scripts/build.sh](scripts/build.sh)\", the last line shows how to run the test:\n\n```bash\n# $BUILD_DIR is \"./build\" by default\n# Set `GTEST_COLOR` to yes or no to enable or disable colored output\n\n# If the library has not been build, target `all` before `check` is required\ncmake --build $BUILD_DIR -j $(nproc) --target all check\n# Or if the library has been build, `check` is enough\ncmake --build $BUILD_DIR -j $(nproc) --target check\n```\n\nTo build and install the python package `pmpp` in current activated conda environment (pmpp operator library would be built automatically if it has not been built yet):\n\n```bash\npip3 install --no-build-isolation -v .\n```\n\n`torch.ops.pmpp.vector_add` will be available after installation; See [test.py](test/test.py) for example.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjamesnulliu%2Flearning-programming-massively-parallel-processors","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjamesnulliu%2Flearning-programming-massively-parallel-processors","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjamesnulliu%2Flearning-programming-massively-parallel-processors/lists"}