{ "info": { "author": "Magnus Jahnen", "author_email": "magnus@jahnen.me", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Intended Audience :: Developers", "Intended Audience :: Science/Research", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7", "Topic :: Scientific/Engineering :: Artificial Intelligence" ], "description": "nvfan\n======\n\nA module to control Nvidia Graphic Cards' fan within python. Features:\n* set constant fan speed\n* set more aggressive fan schedule compared to stock to avoid overhaeting when doing Deep Learning or other computationally intense tasks\n\n## Why?\n\nMy deep learning rig contains 2 GTX 1080ti graphic cards with no liquid cooling. It takes only a few minutes for the GPUs to hit the thermal threshold of 86\u00b0C after I start a training process. Yet, it only uses fans at 50% rate.\n\nThis module uses a more aggressive fan speed and therefore avoids overheating, and thus throttling of GPU frequency at around 90\u00b0 Celsius. \n\n## What is special about it?\n\nYou only have to add two to three lines to your main Deep Learning python script and then the fan speed is adjusted to keep GPU temperature at max 80\u00b0 Celsius. When you Deep Learning pipeline exists, the control of the fann speed is automatically given back to the nvidia driver. Hence, fan speed is significantly reduced when finished to reduce noise.\n\n# How to use it?\n\nControlling nvidia gpu fan requires an `X` server to be running. To run `X` without having a monitor attached to the system requires special config.\n\n\n## Preparation\n\nSetup x config in a shell like below. You may need to use `sudo`.\n\n```shell\n$ nvidia-xconfig --enable-all-gpus --cool-bits=7 --connected-monitor=Monitor0 --allow-empty-initial-configuration --force-generate\n```\n\n*Warning: we used `--force-generate` flag. A backup of your previous config is saved and is reported as the result of running this function.*\n\n\nAa manual configuration could look likke this::\n\n```shell\n$ cat /etc/X11/xorg.conf.d/nv.conf \n# start\n\nSection \"Device\"\n Identifier \"Device0\"\n Driver \"nvidia\"\n VendorName \"NVIDIA Corporation\"\n BoardName \"GeForce GTX 1080 Ti\"\n Option \"Coolbits\" \"4\"\nEndSection\n# trail\n```\n\nSee also https://wiki.archlinux.org/index.php/NVIDIA/Tips_and_tricks\n\n## Run X\n\nI think the best way is to use xinit:\n\n```shell\n$ xinit &\n```\n\nLeavve this sttep out if you are using a desktoop envirronment like Gnoome, KDE, or similar.\n\n## Dependencies\n\nPlease make sure `nvdia-smi` and `nvidia-settings` are installed. The latter usually needs to be installed manually whereas the former is usually included in the nvidia driver package.\n\n## Install nvfan\n\n```shell\n$ pip install nvfan\n```\n\n## Usage\n\nYou can use command line script:\n\n```shell\n$ nvfan constant -g 0 -s 60 # sets a constant speed at 60%\n```\n\nOr in your python script:\n\n```python\nimport nvfan\n\nfirst_gpu = 0\nnvfan.constant(first_gpu, 60)\n```\n\nThe above script, puts GPU 0 in `constant` mode with 60% speed. You can use `aggressive` or `driver` modes too:\n\n```python\nsecond_gpu = 1\n\n# In aggressive mode, a small increase in temperature causes a large increase in fan speed.\nnvfan.aggressive(second_gpu)\n\n# Give control back to the driver manually. Please note that after execution is finished, this line is automatically called so you don't have to.\nnvfan.driver(first_gpu)\nnvfan.driver(second_gpu)\n```\n\nInstead of using the module you can use the `GPU` class to have more control (i.e. setting custom X11 display, if not set `DISPLAY` environment variable is used, or if not set, `:0` is used as fallback)\n\n```python\nimport nvfan\n\ngpu = gpufan.GPU(0, display=\":1\") # or use default `None` for automatic lookup of display\ngpu.aggressive()\n```\n\nYou can also omit the first parameter (`device`) like so:\n\n```python\nimport nvfan\n\ngpu = gpufan.GPU() # or use default `None` for automatic lookup of display\ngpu.aggressive()\n```\n\nThen all available GPUs are set to aggressive speed.\n\n## Decorators\n\nAs another syntactic sugar you can annotate functions, which will set the constant/aggressive speed before calling the decorated method and as soon as it returns will give the control back to the nvidia driver:\n\n```python\nimport time\n\nfrom nvfan.decorators import constant, aggressive\n\n@constant(percentage=95)\ndef main():\n time.sleep(60)\n\n\n@aggressive()\ndef main_agg():\n time.sleep(60)\n\n\nif __name__ == '__main__':\n main()\n main_agg()\n```\n\n## Caution\n\nUse this module at your own risk. The author takes no responsibility and the scripts come with no warranty.", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/magnusja/nvfan", "keywords": "machinelearning ai pytorch tensorflow torch nvidia gpu fan", "license": "", "maintainer": "", "maintainer_email": "", "name": "nvfan", "package_url": "https://pypi.org/project/nvfan/", "platform": "", "project_url": "https://pypi.org/project/nvfan/", "project_urls": { "Bug Reports": "https://github.com/magnusja/nvfan/issues", "Home Page": "https://github.com/magnusja/nvfan", "Homepage": "https://github.com/magnusja/nvfan" }, "release_url": "https://pypi.org/project/nvfan/0.3.0/", "requires_dist": null, "requires_python": ">=3", "summary": "Control Nvidia GPU fan in your python script.", "version": "0.3.0" }, "last_serial": 5282496, "releases": { "0.2.0": [ { "comment_text": "", "digests": { "md5": "9874987473001e6df1dcb9527cf6db55", "sha256": "1ad34a3b907e981f893233902729136ed565b94e44801358624bfe9d8331d9e4" }, "downloads": -1, "filename": "nvfan-0.2.0.tar.gz", "has_sig": false, "md5_digest": "9874987473001e6df1dcb9527cf6db55", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3", "size": 6582, "upload_time": "2019-04-30T14:41:59", "url": "https://files.pythonhosted.org/packages/5c/af/b569dabd435d6b654aaaacee3c593f54a91bd226482459e6857dd863adfc/nvfan-0.2.0.tar.gz" } ], "0.2.0a1": [ { "comment_text": "", "digests": { "md5": "1d720fd8eefccc2cf2bd5d7173dd9946", "sha256": "0497672708735614bafb5ab9cd8f1a93e8c218ee8936b124eef892d3b66480a7" }, "downloads": -1, "filename": "nvfan-0.2.0a1.tar.gz", "has_sig": false, "md5_digest": "1d720fd8eefccc2cf2bd5d7173dd9946", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3", "size": 6594, "upload_time": "2019-04-30T13:25:16", "url": "https://files.pythonhosted.org/packages/fb/7e/0edd5d77816ec0ebc838e3f95d17688b759f4d7d63feb93ce374a655c4c8/nvfan-0.2.0a1.tar.gz" } ], "0.2.0a2": [ { "comment_text": "", "digests": { "md5": "8e98b472dff557d1ac540a5d91338872", "sha256": "38069fb8367b9974c1b46e95b6b8066704a30c3ff0752dbffe4e7f279e74bfd7" }, "downloads": -1, "filename": "nvfan-0.2.0a2.tar.gz", "has_sig": false, "md5_digest": "8e98b472dff557d1ac540a5d91338872", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3", "size": 6596, "upload_time": "2019-04-30T13:37:23", "url": "https://files.pythonhosted.org/packages/07/30/a637f5140d3a74b54e781693e89289deead58017d23ba1f8fec6c1e23561/nvfan-0.2.0a2.tar.gz" } ], "0.2.0a3": [ { "comment_text": "", "digests": { "md5": "e38e73da756e7474a9fcc9a6d3a0a10b", "sha256": "0ecd0c50b385cb71eeac15b6315121174263fdf1f936ec6318fee21c2f073216" }, "downloads": -1, "filename": "nvfan-0.2.0a3.tar.gz", "has_sig": false, "md5_digest": "e38e73da756e7474a9fcc9a6d3a0a10b", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3", "size": 6603, "upload_time": "2019-04-30T13:47:37", "url": "https://files.pythonhosted.org/packages/47/8a/d6bd35e439091eb5a91a3f0d67fae53f78976a9f28f4fbee5cd917987a15/nvfan-0.2.0a3.tar.gz" } ], "0.3.0": [ { "comment_text": "", "digests": { "md5": "992a07a36c7257ee96851ba5ce287e65", "sha256": "497d1ed610ab16d00814cbc264b3579b6efdb2cc3f1e5af83aeccefc6806b81d" }, "downloads": -1, "filename": "nvfan-0.3.0.tar.gz", "has_sig": false, "md5_digest": "992a07a36c7257ee96851ba5ce287e65", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3", "size": 7710, "upload_time": "2019-05-17T14:30:48", "url": "https://files.pythonhosted.org/packages/9f/70/45465766b74567063c41809329956edade8f090310163ad65809c311087d/nvfan-0.3.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "992a07a36c7257ee96851ba5ce287e65", "sha256": "497d1ed610ab16d00814cbc264b3579b6efdb2cc3f1e5af83aeccefc6806b81d" }, "downloads": -1, "filename": "nvfan-0.3.0.tar.gz", "has_sig": false, "md5_digest": "992a07a36c7257ee96851ba5ce287e65", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3", "size": 7710, "upload_time": "2019-05-17T14:30:48", "url": "https://files.pythonhosted.org/packages/9f/70/45465766b74567063c41809329956edade8f090310163ad65809c311087d/nvfan-0.3.0.tar.gz" } ] }