A library for Linear Algebra Calculations (In Progress). Fast allows users to perform linear algebra calculations in python
faster than native python
language or even Numpy
since Fast uses PyBind11 to wrap C++ code into a python
object. Furthermore, Fast utilises Eigen3 Library which specialises in linear algebra calculations and OpenMP to allow parallel matrix calculations to boost performance.
- Python 3.x
- C++ 11.0
- OpenCL and Grpahics Drivers depending on the User's Graphics Card
- PyBind11
- Eigen3 Library
- OpenMP 4.5 and above
- CMake
If all of the aforementioned systems requirements have been met, you can do a quick installation and use the Fast Library, else it is highly recommended that you follow the full installation guide before this step.
-
Clone Fast repository to your preferred location.
-
Clone PyBind11 into the Fast Folder as shown below:
-
Open Terminal and go to the Fast directory
user@user:~$ cd Desktop/Fast
user@user:~/Desktop/Fast$
- Install the Library!
(base) user@user:~/Desktop/Fast$ python setup.py [option]
- For the
option
parameter it is advised to usedevelop
if users wish to customise the functions available in the library. However users can also useinstall
as a parameter. - If no Error messages are shown during the build and installation process,you are now able to use Fast! See the next section on how to use Fast.
- However, if there are errors, it is highly recommended that you follow full installation guide as you may have missing dependencies.
Congratulations! You have finished the hardest part of using this library (installation), Fast allows the use of multi-core CPUs and GPUs to run matrix calculations.
The cpu
class uses Eigen3 and OpenMP to run matrix calculations. Users just have to make a cpu
object in python and run the function they desire.
- An example of an element-wise matrix multiplication:
# Import Fast Library
import fast.fast as ft
# Create the cpu python object
cpu = ft.cpu()
# Create a vector of size 20
A = range(0,20)
# Run the Multiplication!
C = cpu.mul(A,A)
Viola! You are done with the multiplication.
- Available functions:
getmaxCore()
: returns aninteger
value showing the number of cores are available in the user's CPU.mul(A,B)
: Element-wise vector multiplication whereA
andB
are 1-D Arrays with the same size and data-type. Returns a 1-D Array.
The gpu
class utilises the PC's Graphics Processing Unit (GPU) to run the calculations that can be parallelized using OpenCL. Its working is similar to the cpu
class, whereby a gpu
object needs to created before it can used. However it is also advisable to check the available GPUs on your PC before running.
- An example of an element-wise matrix multiplication:
# Import Fast Library
import fast.fast as ft
# Create the cpu python object
gpu = ft.gpu()
# Check available GPU
print(gpu.findGPU())
# Create a vector of size 20
A = range(0,20)
# Run the Multiplication!
C = gpu.mul(A,A)
Again You are Done!
-
WARNING: If the
gpu.findGPU()
functions does not print out any string related to your PC's GPUs, it is safe to assume that you have not installed your drivers for your native GPUs yet, as such please go through full installation guide. -
Available functions:
-
findGPU()
: Provides a List of GPUs available in your PC and uses the first GPU on the list to perform the operations on. -
mul(A,B)
: Element-wise vector multiplication whereA
andB
are 1-D Arrays with the same size and data-type. Returns a 1-D Array.
If you encounter any problems with the Fast Library, send an issue on the repository page along with the details of the error/problem and our support team will get back to you as early as possible! Enjoy!