All Projects → LKedward → focal

LKedward / focal

Licence: MIT License
A modern Fortran abstraction layer for OpenCL

Programming Languages

fortran
972 projects
c
50402 projects - #5 most used programming language
Makefile
30231 projects

Projects that are alternatives of or similar to focal

ZstdFortranLib
👨‍💻Zaak's 🧩(missing) 🏛Standard 🔬Fortran 📚Library 🚧(WIP)
Stars: ✭ 17 (-51.43%)
Mutual labels:  fortran-library, fortran2003, fortran2008, fortran-modules
CB-Fortran-Color-Theme
Code Blocks color theme for Fortran language
Stars: ✭ 21 (-40%)
Mutual labels:  fortran2003, fortran2008
faiNumber-Fortran
A fast, flexible, and secure numerical library for Fortran.
Stars: ✭ 13 (-62.86%)
Mutual labels:  fortran-library, fortran-modules
OpenCL
The content of the OpenCL.org website
Stars: ✭ 18 (-48.57%)
Mutual labels:  opencl, opencl-api
BetterVanillaGenerator
This plugin not only provides better terrain generators for Nukkit, you can also customize your world by modifying the configuration.
Stars: ✭ 26 (-25.71%)
Mutual labels:  opencl
FAST-Pathology
⚡ Open-source software for deep learning-based digital pathology
Stars: ✭ 54 (+54.29%)
Mutual labels:  opencl
opencl-ruby
OpenCL bindings for Ruby
Stars: ✭ 38 (+8.57%)
Mutual labels:  opencl
gr-clenabled
OpenCL/GPU-enabled common blocks for GNURadio
Stars: ✭ 63 (+80%)
Mutual labels:  opencl
slibs
Single file libraries for C/C++
Stars: ✭ 80 (+128.57%)
Mutual labels:  opencl
Learning-Lab-C-Library
This library provides a set of basic functions for different type of deep learning (and other) algorithms in C.This deep learning library will be constantly updated
Stars: ✭ 20 (-42.86%)
Mutual labels:  opencl
Hetero-Mark
A Benchmark Suite for Heterogeneous System Computation
Stars: ✭ 41 (+17.14%)
Mutual labels:  opencl
RayTracing
Realtime GPU Path tracer based on OpenCL and OpenGL
Stars: ✭ 120 (+242.86%)
Mutual labels:  opencl
spector
Spector: An OpenCL FPGA Benchmark Suite
Stars: ✭ 38 (+8.57%)
Mutual labels:  opencl
sycl-bench
SYCL Benchmark Suite
Stars: ✭ 30 (-14.29%)
Mutual labels:  opencl
ctuning-programs
Collective Knowledge extension with unified and customizable benchmarks (with extensible JSON meta information) to be easily integrated with customizable and portable Collective Knowledge workflows. You can easily compile and run these benchmarks using different compilers, environments, hardware and OS (Linux, MacOS, Windows, Android). More info:
Stars: ✭ 41 (+17.14%)
Mutual labels:  opencl
khiva-python
Python binding for Khiva library.
Stars: ✭ 44 (+25.71%)
Mutual labels:  opencl
darknet
Darknet on OpenCL Convolutional Neural Networks on OpenCL on Intel & NVidia & AMD & Mali GPUs for macOS & GNU/Linux
Stars: ✭ 160 (+357.14%)
Mutual labels:  opencl
euler2D-kfvs-Fortran2003
2D solver for Euler equations in quadrilateral grid, using kinetic flux vector splitting scheme, written in OOP F2003
Stars: ✭ 17 (-51.43%)
Mutual labels:  fortran2003
primitiv-python
Python binding of primitiv.
Stars: ✭ 17 (-51.43%)
Mutual labels:  opencl
pystella
A code generator for grid-based PDE solving on CPUs and GPUs
Stars: ✭ 18 (-48.57%)
Mutual labels:  opencl

Focal

License: MIT fpm test codecov

A modern Fortran abstraction layer for OpenCL

Focal is a module library which wraps calls to the OpenCL runtime API (using clfortran) with a higher abstraction level appropriate to the Fortran language.

The goal of Focal is to provide a concise and accessible Fortran interface to the OpenCL API while retaining the full functionality thereof. This is desirable in Fortran which as a language provides a higher level of abstraction than C; importantly this allows scientists and engineers to focus on their domain specific problem rather than details of low-level implementation.

Key features:

  • Removes use of c pointers to call OpenCL API
  • Provides a level of type safety using typed buffer objects
  • Decreases verbosity of OpenCL API calls while still providing the same functionality
  • Abstracts away low level details, such as size in bytes
  • Contains built-in customisable error handling for all OpenCL API calls
  • Contains built-in 'debug' mode for checking program correctness
  • Contains build-in routines for collecting and presented profiling information

Project status: v1.0.1 stable release

Documentation: lkedward.github.io/focal-docs

License: MIT

Prerequisites:

Getting started

Quick example

The following fortran program calculates the sum of two large arrays using an OpenCL kernel.

program sum
!! Focal example program: calculate the sum of two arrays on an OpenCL device

use Focal
implicit none

integer, parameter :: Nelem = 1E6           ! No. of array elements
real, parameter :: sumVal = 10.0            ! Target value for array sum

integer :: i                                ! Counter variable
character(:), allocatable :: kernelSrc      ! Kernel source string
type(fclDevice) :: device                   ! Device object
type(fclProgram) :: prog                    ! Focal program object
type(fclKernel) :: sumKernel                ! Focal kernel object
real :: array1(Nelem)                       ! Host array 1
real :: array2(Nelem)                       ! Host array 2
type(fclDeviceFloat) :: array1_d            ! Device array 1
type(fclDeviceFloat) :: array2_d            ! Device array 2

! Select device with most cores and create command queue
device = fclInit(vendor='nvidia',sortBy='cores')
call fclSetDefaultCommandQ(fclCreateCommandQ(device,enableProfiling=.true.))

! Load kernel from file and compile
call fclSourceFromFile('examples/sum.cl',kernelSrc)
prog = fclCompileProgram(kernelSrc)
sumKernel = fclGetProgramKernel(prog,'sum')

! Initialise device arrays
call fclInitBuffer(array1_d,Nelem)
call fclInitBuffer(array2_d,Nelem)

! Initialise host array data
do i=1,Nelem
  array1(i) = i
end do
array2 = sumVal - array1

! Copy data to device
array1_d = array1
array2_d = array2

! Set global work size equal to array length and launch kernel
sumKernel%global_work_size(1) = Nelem
call sumKernel%launch(Nelem,array1_d,array2_d)

! Copy result back to host and print out to check
array2 = array2_d
write(*,*) array2(1), array2(size(array2,1))

end program sum

Where sum.cl contains the following openCL kernel:

__kernel void sum(const int nElem, const __global float * v1, __global float * v2){
  int i = get_global_id(0);
  if(i < nElem) v2[i] += v1[i];
}

Bundled third-party sources

The following open source libraries are used as dependencies and bundled in the repository (./external):

Acknowledgement

This work was funded by the MENtOR project, a UKVLN project supported by the Engineering and Physical Sciences Research Council (EPSRC) of the UK. Grant reference number EP/S010378/1.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].