Posts

Showing posts from March, 2021

How to program CUDA with Python

#An introduction to CUDA in Python #Coding directly in Python functions that will be executed on GPU may allow # to remove bottlenecks while keeping the code short and simple. In this introduction, # we show one way to use CUDA in Python, and explain some basic principles of CUDA programming. #We choose to use the Open Source package Numba. # Numba is a just-in-time compiler for Python that allows in particular to write CUDA kernels. # Numba is freely available at https://github.com/numba/numba. #Note that there are other packages, such as PyCUDA, that also allow to launch CUDA kernels in Python. #Preliminary #Let’s define first some vocabulary: #a CUDA kernel is a function that is executed on the GPU, #the GPU and its memory are called the device, #the CPU and its memory are called the host. #Now let’s check the versions used in this notebook: import sys import numba import numpy print ( "Python version:" , sys.version) print ( "Numba version:" , numba. __version__...

How to Import a packgae in PyCharm?

  First of all import the pacakage of pip in python console. import pip The below command will upgrade the version of package setuptools. pip.main([ 'install' , '--upgrade' , 'setuptools' ]) The below command will install the scikit-learn and numpy packages. pip.main([ 'install' , 'numpy' , 'scikit-learn' ]) How to Import CX_Oracle in PyCharm? Open PyCharm and then Open your project. Click on the menu  File > Settings  and then the Settings window will open. In the Settings window, click on the  Project  node to expand and then click on the  Project Interpreter . Then on the right side, click on the  +  button to open  Available Packages  window, as shown in below image. Then search for  cx_Oracle  in the search box. Below you will find the cx_Oracle package. Click on it to select and then click on the  Install Package  button as shown below. import cx_Oracle connection = cx_Oracle . connect ( "scott" , "tige...