A CPU/GPU library for finding the minimum of a quartic function
Project description
CUDA-quartic-solver
A general cubic equation solver and quartic equation minimisation solver written for CPU and Nvidia GPUs, for more details and results, see: https://arxiv.org/abs/1903.10041. The library is available for C++/CUDA as well as Python using Pybind11.
Running the solver
Requirements
- CUDA 9.0+ capable GPU and nvcc required to run the GPU solvers
- CMake 3.8+
- Python 3.6, numpy (if using Python)
- Pybind11 v2.5.0+ (installation instructions)
CMake
CMake can be used to build the project, for example:
git clone --recursive https://github.com/qureshizawar/CUDA-quartic-solver
mkdir build && cd build
cmake -D CMAKE_BUILD_TYPE=Release ../ -D CPP_exe=true -D GPU_build=false
make
When the CPP_exe
flag is set to true
, CMake will build a c++ executable, then quartic_solver_main
can be executed to run the example code.
When the GPU_build
flag is set to true
, CMake will build the CUDA capable version of the library.
Python
The Python package can be installed by building its .whl
file, for example:
git clone --recursive https://github.com/qureshizawar/CUDA-quartic-solver
python setup.py bdist_wheel --GPU_build True
When the GPU_build
flag is set to True
, the CUDA capable version of the library will be built.
The built .whl
can then be used to install the package, for example:
pip install ./dist/QuarticSolver-0.1.1-cp36-cp36m-linux_x86_64.whl
Usage
Please see src/main.cu
, src/cpu_main.cpp
, and the examples in the /tests
folder for detailed usage examples
C++
Given quartic functions of the form Ax^4 + Bx^3 + Cx^2 + Dx + E
the minimiser for the quartic functions can calculated on the CPU by calling the following function from cpu_solver.cpp
:
QuarticMinimumCPU(N, A, B, C, D, E, min);
Where:
N
is the number of functionsA
is an array containing the coefficient A for each of the quartic functionsB
is an array containing the coefficient B for each of the quartic functionsC
is an array containing the coefficient C for each of the quartic functionsD
is an array containing the coefficient D for each of the quartic functionsE
is an array containing the coefficient E for each of the quartic functionsmin
is an array which will contain the corresponding minimums for each of the quartic functions
The calculations can be carried out on a GPU by using QuarticMinimumGPU
or QuarticMinimumGPUStreams
. Please note signifcant performance improvement is observed when N>10000
for QuarticMinimumGPU
vs QuarticMinimumGPUStreams
Python
The Python version of the library can be used as follows:
import numpy as np
import QuarticSolver
minimum = QuarticSolver.QuarticMinimum(A,B,C,D,E,True)
Where A
,B
,C
,D
,E
are numpy arrays containing the quartic function coefficients and the final arg is a boolean flag which if set to True
will use the GPU if possible. minimum
is the returned numpy array containing the corresponding minimisers.
TODO
- Add multi-gpu support
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
File details
Details for the file QuarticSolver-0.1.5.tar.gz
.
File metadata
- Download URL: QuarticSolver-0.1.5.tar.gz
- Upload date:
- Size: 616.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/45.2.0 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.6.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7922eed4baf5a8145bad8cd2d28865fe6db93e30a2abdca873fc27cbd574ee87 |
|
MD5 | b582d3b47b76461b08ab0ad39dd34602 |
|
BLAKE2b-256 | 96b79c6ecc7c8e633579d452ffdf6c9dc869a81133cca4f4fe09b2642a0a17c1 |
File details
Details for the file QuarticSolver-0.1.5-cp38-cp38-manylinux2010_x86_64.whl
.
File metadata
- Download URL: QuarticSolver-0.1.5-cp38-cp38-manylinux2010_x86_64.whl
- Upload date:
- Size: 115.7 kB
- Tags: CPython 3.8, manylinux: glibc 2.12+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/45.2.0 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.6.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a0aa606e7df7906ab2c4a7b1e8c6049ef8c4e1d82902fa2c5eea775359897279 |
|
MD5 | 7688914b1a8af8f8e73d8be10aa0b8b1 |
|
BLAKE2b-256 | ac6dcc4bd6141eca61a016f1f9b64eb0a782677afcc8750bc9774f0097f4d244 |
File details
Details for the file QuarticSolver-0.1.5-cp38-cp38-manylinux2010_i686.whl
.
File metadata
- Download URL: QuarticSolver-0.1.5-cp38-cp38-manylinux2010_i686.whl
- Upload date:
- Size: 85.0 kB
- Tags: CPython 3.8, manylinux: glibc 2.12+ i686
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/45.2.0 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.6.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a53011389971cf4492b325c2be318efd567ff9672146e7ae796053edf1841f80 |
|
MD5 | 6c03516cb3d12f9a38e113748cedc408 |
|
BLAKE2b-256 | c5b644f1573fbe335a10b858e7d2bbbd3ad3b0219c96beb6eb2db4a1ba097a2f |
File details
Details for the file QuarticSolver-0.1.5-cp38-cp38-macosx_10_9_x86_64.whl
.
File metadata
- Download URL: QuarticSolver-0.1.5-cp38-cp38-macosx_10_9_x86_64.whl
- Upload date:
- Size: 52.6 kB
- Tags: CPython 3.8, macOS 10.9+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.8.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3509ed82076905aaaf201bbed4ffb3c08220741c76f89cb4e984b838b0294a24 |
|
MD5 | b4eda800beaceb1965576d5556e14701 |
|
BLAKE2b-256 | 140f32aaa898c4880bdc2b38f8fb234587cc2270076d027f75cba54c17f9841e |
File details
Details for the file QuarticSolver-0.1.5-cp37-cp37m-manylinux2010_x86_64.whl
.
File metadata
- Download URL: QuarticSolver-0.1.5-cp37-cp37m-manylinux2010_x86_64.whl
- Upload date:
- Size: 116.1 kB
- Tags: CPython 3.7m, manylinux: glibc 2.12+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/45.2.0 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.6.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 764c5389935b5df05e247fc2d57f3849912b464e93669ddb6506c82f8dd9a58d |
|
MD5 | 6beab6bd736b025005db7e14df1f24c5 |
|
BLAKE2b-256 | c08f5285f1a6e9e8fc90ea21f83b7d9b6da8b3e91898c030def474fec4a4ea94 |
File details
Details for the file QuarticSolver-0.1.5-cp37-cp37m-manylinux2010_i686.whl
.
File metadata
- Download URL: QuarticSolver-0.1.5-cp37-cp37m-manylinux2010_i686.whl
- Upload date:
- Size: 85.0 kB
- Tags: CPython 3.7m, manylinux: glibc 2.12+ i686
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/45.2.0 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.6.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0b0363d3a04c8b113da303d166cb50ed5bedbadb71dbd8dbf45f58d5f1b40bda |
|
MD5 | 2de27bd911d79977b334810ba3d0c830 |
|
BLAKE2b-256 | e54cd77869f799a38a758ee59bb3e667a8ce3c9b89e4666459b28308edf172e8 |
File details
Details for the file QuarticSolver-0.1.5-cp37-cp37m-macosx_10_9_x86_64.whl
.
File metadata
- Download URL: QuarticSolver-0.1.5-cp37-cp37m-macosx_10_9_x86_64.whl
- Upload date:
- Size: 51.9 kB
- Tags: CPython 3.7m, macOS 10.9+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.8.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ff1b87e605de2ca62df728005b5381509e3ffa2a7e0da103e34f16e4520ea784 |
|
MD5 | 0f85ead59bc4d4a9f1def365de7e0bab |
|
BLAKE2b-256 | 56169f507102e19410165a529d7d6788edcd0a8ce133a44dbbe2d3f746e37c8d |
File details
Details for the file QuarticSolver-0.1.5-cp36-cp36m-win_amd64.whl
.
File metadata
- Download URL: QuarticSolver-0.1.5-cp36-cp36m-win_amd64.whl
- Upload date:
- Size: 62.1 kB
- Tags: CPython 3.6m, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/28.8.0 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.6.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9d8c3077a4576e15dbefa4568d31ef6b3c2f2bb3f56cd6348b4a14045a47104f |
|
MD5 | 95ce93784806ffde7aef4e9db5f20c7f |
|
BLAKE2b-256 | fdaefc219e49b50e989f78a7c214c601029a481ad7658b2375d1d155f2373e1e |
File details
Details for the file QuarticSolver-0.1.5-cp36-cp36m-win32.whl
.
File metadata
- Download URL: QuarticSolver-0.1.5-cp36-cp36m-win32.whl
- Upload date:
- Size: 56.9 kB
- Tags: CPython 3.6m, Windows x86
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/28.8.0 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.6.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 33ca5d9eef15605ef782b065f2cc10e87fbddf48751a5c9d89f66c8cab458b2a |
|
MD5 | ea688430e9f2b886826539f25ac64b28 |
|
BLAKE2b-256 | 7b5f58897be7e8dad32604cd8c83575d0f57f61ced6614e6da399469524647d4 |
File details
Details for the file QuarticSolver-0.1.5-cp36-cp36m-manylinux2010_x86_64.whl
.
File metadata
- Download URL: QuarticSolver-0.1.5-cp36-cp36m-manylinux2010_x86_64.whl
- Upload date:
- Size: 115.9 kB
- Tags: CPython 3.6m, manylinux: glibc 2.12+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/45.2.0 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.6.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8899f312ee0c7b5319823be11b610ad11a56d014aad385b240d11ce8b2ae02bf |
|
MD5 | 2460eaa877b70fc1732493ce24b32587 |
|
BLAKE2b-256 | e7e319d9c57053f473858165e2de9d1592937d9346545caa95eda97332a8ecf9 |
File details
Details for the file QuarticSolver-0.1.5-cp36-cp36m-manylinux2010_i686.whl
.
File metadata
- Download URL: QuarticSolver-0.1.5-cp36-cp36m-manylinux2010_i686.whl
- Upload date:
- Size: 85.2 kB
- Tags: CPython 3.6m, manylinux: glibc 2.12+ i686
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/45.2.0 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.6.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7a8c66bc89746a7c92fe78779860985a66bb64e7327bc2514064342c47ee6e43 |
|
MD5 | 7ff27c464a6d8c1f94c3524144942d89 |
|
BLAKE2b-256 | 99ab73c32f14db9be5c8c84039da53ded083dc85dd0ccb105c981d69c83da85c |
File details
Details for the file QuarticSolver-0.1.5-cp36-cp36m-macosx_10_9_x86_64.whl
.
File metadata
- Download URL: QuarticSolver-0.1.5-cp36-cp36m-macosx_10_9_x86_64.whl
- Upload date:
- Size: 51.7 kB
- Tags: CPython 3.6m, macOS 10.9+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.6.8
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c9943d04ff174e65d9190d5db61a4f089ae2d873095885e0f9909085dca85009 |
|
MD5 | b066fa250d050f87b4201c11d53ae8cb |
|
BLAKE2b-256 | ef30323916b10f3adc758c797741a5ef94b66bdd7f97985fb82819fcf50861a0 |
File details
Details for the file QuarticSolver-0.1.5-cp35-cp35m-manylinux2010_x86_64.whl
.
File metadata
- Download URL: QuarticSolver-0.1.5-cp35-cp35m-manylinux2010_x86_64.whl
- Upload date:
- Size: 115.9 kB
- Tags: CPython 3.5m, manylinux: glibc 2.12+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/45.2.0 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.6.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4e1516c39ab09fe21f1584f22b46ee2252ebc509d79aa496112508b206c3def6 |
|
MD5 | e417dc5166fa5cf1866adcc7cc85e6d9 |
|
BLAKE2b-256 | 59c6c902eb8913c5f68d4d1ea20dbb03937a8fd564b89a23ea7cade0a5606d6e |
File details
Details for the file QuarticSolver-0.1.5-cp35-cp35m-manylinux2010_i686.whl
.
File metadata
- Download URL: QuarticSolver-0.1.5-cp35-cp35m-manylinux2010_i686.whl
- Upload date:
- Size: 85.3 kB
- Tags: CPython 3.5m, manylinux: glibc 2.12+ i686
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/45.2.0 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.6.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4d2c596d42c91f24cb16d9105a63e2dba53e195179f00ead3f6c3ab6feb69c8d |
|
MD5 | a85c524113e2f61bf497fbba2a17ae43 |
|
BLAKE2b-256 | 6b6b8824de88e6dbc9b5fec0f18bd84f6d1150e468f5a9aa7795ee9f96adacd1 |
File details
Details for the file QuarticSolver-0.1.5-cp35-cp35m-macosx_10_9_x86_64.whl
.
File metadata
- Download URL: QuarticSolver-0.1.5-cp35-cp35m-macosx_10_9_x86_64.whl
- Upload date:
- Size: 51.7 kB
- Tags: CPython 3.5m, macOS 10.9+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.8.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 571885a67b5de4c62418093ab1b1d8edd7537d919327359916e9326ea653a0d1 |
|
MD5 | e2e30c1dc6ebc78be316a7e6312d36bf |
|
BLAKE2b-256 | 8450606a13b2cb85fef85a75e14ba4046863391e394712453517b5163df31a76 |