{"id":13605067,"url":"https://github.com/MachineLearningSystem/Magicube","last_synced_at":"2025-04-12T02:32:52.489Z","repository":{"id":185461849,"uuid":"569121699","full_name":"MachineLearningSystem/Magicube","owner":"MachineLearningSystem","description":"Magicube is a high-performance library for quantized sparse matrix operations (SpMM and SDDMM) of deep learning on Tensor Cores.","archived":false,"fork":true,"pushed_at":"2022-11-10T08:21:46.000Z","size":45285,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2024-08-02T19:36:53.110Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":null,"has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"Shigangli/Magicube","license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/MachineLearningSystem.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}},"created_at":"2022-11-22T05:57:45.000Z","updated_at":"2022-11-22T05:57:40.000Z","dependencies_parsed_at":null,"dependency_job_id":"dfe27e61-25aa-4756-9d45-1f101345da34","html_url":"https://github.com/MachineLearningSystem/Magicube","commit_stats":null,"previous_names":["machinelearningsystem/magicube"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MachineLearningSystem%2FMagicube","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MachineLearningSystem%2FMagicube/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MachineLearningSystem%2FMagicube/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MachineLearningSystem%2FMagicube/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/MachineLearningSystem","download_url":"https://codeload.github.com/MachineLearningSystem/Magicube/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223489724,"owners_count":17153813,"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":[],"created_at":"2024-08-01T19:00:54.368Z","updated_at":"2024-11-07T09:31:29.278Z","avatar_url":"https://github.com/MachineLearningSystem.png","language":null,"readme":"## Magicube: Efficient Quantized Sparse Matrix Operations on Tensor Cores\n\n![Magicube Logo](magicubeLogo.svg)\n\nMagicube is a high-performance library for quantized sparse matrix operations (SpMM and SDDMM) of deep learning on Tensor Cores. Magicube is published in [SC 2022](https://sc22.supercomputing.org/), Best Paper Finalist. We conduct all the experiments on NVIDIA A100-SXM4-40GB GPU. The software requirements to reproduce the artfifact are: `GCC 8.4.1`, `CUDA Toolkit 11.4.0`, `Python 3.8.5`, `PyTorch 1.9.0` with `cuDNN version 8005`.\n\n**We provide two ways to reproduce the results.** The first way is to reproduce the artifact with **docker container**, in which the software environment is already configured and the input dataset is also included. Note that nvidia-docker must be installed to run the container on GPU. Using docker container enables an easy reproducibility process. The second way is to reproduce the artifact with **source code**, in which users have to setup the software environment and download the input dataset by themselves following the provided instructions.\n\n## Reproduction with container\n\nWe run all the experiments on NVIDIA A100-SXM4-40GB GPU. Please double-check the model of GPU by `nvidia-smi -L`. Note that nvidia-docker must be installed to run the container on GPU. Use the following three steps to reproduce the artifact with docker container.\n\n**Step 1:** Download and run the container.\n\nDownload magicube_container.tar.gz from the DOI by:\n\n```bash\nwget https://zenodo.org/record/6924338/files/magicube_container.tar.gz\n```\n\nRun the container and activate python by:\n\n```bash\ndocker load -i magicube_container.tar.gz\ndocker run -it --gpus all magicube_container\nsource /artifacts/sc22_venv/bin/activate\n```\n\n**Step 2:** Compile and run the experiments.\n\n**(1)** To reproduce the results of Fig. 11:\n\n```bash\ncd /artifacts/Magicube/SpMM/ablation_study\n\n# about 3 minutes\nbash compile_jobs.sh\n\n# about 3 minutes\nbash spmm_ablation_study.sh \u003e spmm_abl_study.txt\n```\n\n**(2)** To reproduce the results of Fig. 12:\n\n```bash\ncd /artifacts/Magicube/SpMM/SpMM\n\nbash setup.sh\n\n# about 5 minutes\nbash spmm_pres.sh \u003e spmm_pres.txt\n```\n\n**(3)** To reproduce the results of Fig. 13:\n\n```bash\ncd /artifacts/Magicube/SDDMM/ablation_study\n\nbash compile_jobs.sh\n\n# about 5 minutes\npython sddmm_ablation_study.py \u003e sddmm_abl_study.txt\n```\n\n**(4)** To reproduce the results of Fig. 14:\n\n```bash\ncd /artifacts/Magicube/baselines\nbash setup.sh\n\n# about 13 hours\nbash run_spmm_baselines.sh\n\ncd /artifacts/Magicube/SpMM/SpMM\nbash setup.sh\n\n# about 8 hours\nbash run_spmm_magicube.sh\n```\n\n**(5)** To reproduce the results of Fig. 15:\n\n```bash\ncd /artifacts/Magicube/baselines\nbash setup.sh\n\n# about 8 hours\nbash run_sddmm_baselines.sh\n\ncd /artifacts/Magicube/SDDMM/SDDMM\nbash setup.sh\n\n# about 5 hours\nbash run_sddmm_magicube.sh\n```\n\n**(6)** To reproduce the results of Fig. 16:\n\n```bash\ncd /artifacts/Magicube/end2end_eval/ sparse_transformer_baselines/src\nbash install.sh\ncd ..\n\n# about 0.5 hour\npython launch_cudnn_fp16.py \u003e pytorch_n2n.txt\n\n# about 0.8 hour\npython launch_vectorSparse.py \u003e vectorSparse_n2n.txt\n\ncd /artifacts/Magicube/end2end_eval/sparse_transformer_magicube/src\nbash install.sh\ncd ..\n\n# about 2.6 hours\npython launch_magicube.py \u003e magicube_n2n.txt\n```\n\n**Step 3**: Plot the figures.\n\n```bash\ncd /artifacts/Magicube/plot\n\n# generate csv files\nbash gen_csv.sh\n\n# plot figures\nbash plot.sh\n\n# copy figures\ncd /artifacts/Magicube/plot/figs\nscp *.pdf username@hostmachine:/host/path/target\n```\n\n## Reproduction with source code\n\nDifferent from docker container, users have to setup the software environment and download the input dataset by themselves when reproducing from source code.\n\n**Step 1**: Prepare dataset and code, and setup python environment.\n\nDownload input dataset and source code:\n\n```bash\nwget https://storage.googleapis.com/sgk-sc2020/dlmc.tar.gz\ntar -xvf dlmc.tar.gz\nexport dataset_dir=/the/path/of/dlmc \ngit clone git@github.com:Shigangli/Magicube.git\n```\n\nSetup python environment:\n\n```bash\nconda create --name py38_sc22 python=3.8\nconda activate py38_sc22\npip install torch==1.9.1+cu111 torchvision==0.10.1+cu111 torchaudio==0.9.1 -f https://download.pytorch.org/whl/torch_stable.html\npip install -r requirements.txt\n```\n\n**Steps 2\u00263**: Suppose the source code is in the path of `/artifacts/Magicube/`. Then, follow the same Steps 2\u00263 as reproduction with container to reproduce the results and figures.\n\n## Publication\n\nMagicube is pulished in SC 2022, Best Paper Finalist. To cite our work:\n```bibtex\n@inproceedings{li2022efficient,\n  title={Efficient Quantized Sparse Matrix Operations on Tensor Cores},\n  author={Li, Shigang and Osawa, Kazuki and Hoefler, Torsten},\n  booktitle={International Conference for High Performance Computing, Networking, Storage and Analysis (SC'22)},\n  year={2022}\n}\n```\n\n## License\n\nSee [LICENSE](LICENSE).\n","funding_links":[],"categories":["Paper-Code"],"sub_categories":["Optimization"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FMachineLearningSystem%2FMagicube","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FMachineLearningSystem%2FMagicube","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FMachineLearningSystem%2FMagicube/lists"}