{"id":17725410,"url":"https://github.com/ionmich/cs149-local-dev","last_synced_at":"2025-03-31T14:19:57.603Z","repository":{"id":259167861,"uuid":"876455083","full_name":"IonMich/cs149-local-dev","owner":"IonMich","description":"Provides `conda` installation instructions for Stanford's CS149 (Parallel Computing) programming assignments","archived":false,"fork":false,"pushed_at":"2024-10-22T04:45:59.000Z","size":5,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-10-23T05:34:01.868Z","etag":null,"topics":["conda","cs149","cuda","ispc","parallel-computing"],"latest_commit_sha":null,"homepage":"","language":null,"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/IonMich.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-10-22T02:04:26.000Z","updated_at":"2024-10-22T04:46:02.000Z","dependencies_parsed_at":"2024-10-23T07:27:22.686Z","dependency_job_id":"d771333f-5b02-4447-bf59-78ac9c7a13f1","html_url":"https://github.com/IonMich/cs149-local-dev","commit_stats":null,"previous_names":["ionmich/cs149-local-dev"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/IonMich%2Fcs149-local-dev","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/IonMich%2Fcs149-local-dev/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/IonMich%2Fcs149-local-dev/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/IonMich%2Fcs149-local-dev/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/IonMich","download_url":"https://codeload.github.com/IonMich/cs149-local-dev/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246481004,"owners_count":20784458,"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":["conda","cs149","cuda","ispc","parallel-computing"],"created_at":"2024-10-25T16:04:23.881Z","updated_at":"2025-03-31T14:19:57.580Z","avatar_url":"https://github.com/IonMich.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# cs149-local-dev\nRecently Stanford published all [video recordings](https://www.youtube.com/playlist?list=PLoROMvodv4rMp7MTFr4hQsDEcX7Bx6Odp) from the Fall 2023 CS149 (Parallel Computing) course. It is an exellent resource for learning about parallel computing on CPUs and GPUs, and hardware specific programming languages like CUDA and ISPC.\n\nIt appears that the course offers allocation of AWS instances and access to Stanford's [Myth machines](https://web.stanford.edu/class/cs107a/notes/myth-machines). This repository is an attempt to provide instructions for setting up a local development environment for the course programming assignments. \n\nSome important notes:\n- The assignments occasionally provide local installation instructions, but they are not always cross-platform. **Always check first the original assignment repositories for the most up-to-date instructions.** This repository is not affiliated with Stanford University.\n- About half of Assignment 1 involves ISPC code. Check the [ISPC](https://ispc.github.io/downloads.html) website to verify that your system is compatible. It appears that while ISPC was originally developed for Intel CPUs, ISPC is now compatible with AMD and ARM-based CPUs as well, including Apple's ARM-based M chips.\n- Assignments 3 and 4 involve CUDA code. You will need an NVIDIA GPU to complete these assignments.\n- These instructions have been tested only on a Ubuntu 22.04 machine with an RTX 3060Ti. If you have tested the instructions on a different system, please submit a pull request to update this README.\n\n\u003c!-- table of testing --\u003e\n\u003c!-- explain --\u003e\n- :white_check_mark: - Tested and working\n- :yellow_circle: - Tested and partially working\n- :grey_question: - Not tested\n- :x: - Could not get it to work\n\n| Assignment   | Ubuntu 22.04       | MacOS 12.3      | Windows 10      |\n| ------------ | ------------------ | --------------- | --------------- |\n| Assignment 1 | :white_check_mark: | :grey_question: | :grey_question: |\n| Assignment 2 | :white_check_mark: | :grey_question: | :grey_question: |\n| Assignment 3 | :white_check_mark: | :grey_question: | :grey_question: |\n| Assignment 4 | :white_check_mark: | :grey_question: | :grey_question: |\n| Assignment 5 | :grey_question:    | :grey_question: | :grey_question: |\n\nThis repository provides `conda` installation instructions for Stanford's CS149 (Parallel Computing) programming assignments. With `conda` you can isolate the particular Python environment needed for each assignment (or the course as a whole), and avoid conflicts with other projects on your system.\n\n## Getting Started\n\n- Verify that `gcc` and `g++` are both installed on your system and that their versions match.\n\n   ```bash\n   gcc --version\n   g++ --version\n   ```\n   If they do not match, follow this StackOverflow [post](https://askubuntu.com/a/26502) to create the appropriate symlinks. Tested with `gcc`/`g++` version 12.3.0 on Ubuntu 22.04.\n- Create a new conda environment for the course:\n\n   ```bash\n   conda create -n cs149\n   conda activate cs149\n   ```\n\n\n## Assignment 1\n\nLink to Official Github Repo: [Assignment 1](https://github.com/stanford-cs149/asst1)\n\n\nClone the repository and install the dependencies:\n\n```shell\n\ngit clone git@github.com:stanford-cs149/asst1.git\ncd asst1\n```\n\n**ISPC:** On Ubuntu the prefered method of installation is through [the Snap store](https://snapcraft.io/ispc). Alternatively, with the newly created `cs149` conda environment activated, install ispc from the conda-forge channel:\n\n```shell\nconda install conda-forge::ispc\n```\n\nThat's it! You should now be able to build the executables for each part of the assignment by running `make` in the respective directories. \n\n\u003e [!NOTE]\n\u003e In Program 6 (K-Means) you need to uncomment the portion of `main.cpp` that generates the input data. After you have generated the input data, you can comment out that portion of the code and run the program as normal.\n\n## Assignment 2\n\nLink to Official Github Repo: [Assignment 2](https://github.com/stanford-cs149/asst2)\n\nNo additional dependencies are required for this assignment (a compatible `g++` is all we need). \n\nClone the repository and build the executables for each part of the assignment by running `make` in the respective directories. The included executable `part_a/runtasks_ref_linux` also was tested and it works.\n\n## Assignment 3\n\nLink to Official Github Repo: [Assignment 3](https://github.com/stanford-cs149/asst3)\n\nClone the repository via git as in the previous assignments. \n\n\u003e [!NOTE] \n\u003e This assignment requires a compatible NVIDIA GPU and CUDA.\n\n\u003e [!NOTE]  \n\u003e As mentioned in one of the provided `readme` [here](https://github.com/stanford-cs149/asst3/blob/master/cloud_readme.md#setting-up-the-vm-environment), if you are on an Ubuntu 22.04 machine, you may be able to install everything via the `install.sh` script provided in the assignment repository:\n\u003e   \n\u003e   ```shell\n\u003e   chmod +x ./install.sh\n\u003e   ./install.sh\n\u003e   ```\n\u003e However that this script is intended for the AWS VMs, so use it at your own risk.\n\nWith conda, we can install CUDA via NVIDIA's official [conda channel](https://anaconda.org/nvidia/cuda). However, this installation defines environment variables such as `CXX` and `CXXFLAGS` that are also referenced in the `Makefile` of the assignment. Getting the `Makefile` to work with the conda-installed CUDA and OpenGL+Glut appears to be very tricky.\n\nA solution is to install cuda system-wide via the [installer](https://developer.nvidia.com/cuda-downloads?target_os=Linux\u0026target_arch=x86_64\u0026Distribution=Ubuntu\u0026target_version=22.04\u0026target_type=deb_network) provided by NVIDIA for CUDA Toolkit. For the rendering part, GLUT can be installed in Ubuntu via `apt`:\n\n```shell\n\nsudo apt-get install freeglut3-dev\n```\n\nFinally you might need to specify the compute capability of your GPU in the `Makefile` of the assignment. Specifically for GeForce 30 series GPUs, you need to specify `-arch=sm_86` in the `NVCCFLAGS` variable in the `Makefile`:\n\n```makefile\nNVCCFLAGS = -O3 -arch=sm_86\n```\n\nYou can find the compute capability of your GPU [here](https://developer.nvidia.com/cuda-gpus).\n\n# Assignment 4\n\nAfter a bit of trial and error, the following combination of package versions appears to work on Ubuntu 22.04:\n\n```shell\nconda create -n gpt149\nconda activate gpt149\nconda install pytorch==2.1.2 torchvision==0.16.2 torchaudio==2.1.2 pytorch-cuda=11.8 python=3.10 numpy=1.26 ninja tiktoken -c pytorch -c nvidia -c conda-forge\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fionmich%2Fcs149-local-dev","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fionmich%2Fcs149-local-dev","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fionmich%2Fcs149-local-dev/lists"}