To configure a system-wide PyCUDA installation for Python, you can create a new project on PyCharm or change your system interpreter. Follow these steps to configure PyCharm to use the system-wide installation of Python:
- Create a new project in PyCharm:
- Instead of a Conda environment, we will now select the preinstalled system-wide Python installation on Ubuntu:
Once this environment has been created, you can now start using the user-specific system-wide PyCUDA installation on PyCharm:
PyCharm will still prefer to use the system-wide configuration if you want to go back to using your Conda-based PyCUDA projects that were set up within the virtual environment. To make PyCharm re-recognize the Conda-based PyCUDA package once again, you'll have to perform the following steps:
- First, go to Settings in the File menu:
- Now click on the gear symbol shown on the top-right area of the Settings window:
- Click on Show All:
- Select your project interpreter from the list and click on the icon that says Show paths for the selected interpreter when you hover over it using the mouse:
- Remove the user-specified path that PyCharm sees system-wide. Click OK:
- Hit OK once again in the Project Interpreters window. Finally, click on Apply in the Settings window for the changes to take effect.
- Now you can start using your Conda-specific local PyCUDA package once again:
If you wish to switch between the two, all you have to do is toggle between Python 3.6 /usr/bin/python3.6 and the Conda-based virtual environment in the system interpreter window:
We are now ready to begin computing with PyCUDA!