Skip to content

Latest commit

 

History

History
108 lines (86 loc) · 2.36 KB

README.md

File metadata and controls

108 lines (86 loc) · 2.36 KB

cutf - CUDA Template Functions

The library of the CUDA/C++ Otaku, by the CUDA/C++ Otaku(?), for the CUDA/C++ Otaku shall not perish from the earth.

Warning!

This library is under developing. Destructive changes may occur.

Introduction

cutf is a tiny CUDA template library.

  • header file only
  • at least C++14

Development

Example

// sample.cu
// Compile:
// nvcc -I/path/to/cutf/include/ sample.cu ...
#include <cutf/math.hpp>
#include <cutf/type.hpp>
#include <cutf/error.hpp>
#include <cutf/memory.hpp>
constexpr float PI = 3.f;
constexpr std::size_t N = 15;

template <class T, int N>
__global__ void kernel_example(T* const output, const T* const input){
	const auto tid = blockIdx.x * blockDim.x + threadIdx.x;
	if( tid >= N ) return;

	output[tid] = cutf::math::sin( __ldg(input + tid) * cutf::type::cast<T>(PI) );
}

using T = float;
int main(){
	auto in = cutf::memory::get_device_unique_ptr<T>(N);
	auto out = cutf::memory::get_device_unique_ptr<T>(N);
	auto h_out = cutf::memory::get_host_unique_ptr<T>(N);

	kernel_example<T, N><<<(N+15)/16,16>>>(out.get(), in.get());

	CUTF_CHECK_ERROR(cutf::memory::copy(h_out.get(), out.get(), N));
}

Namespace structure

cutf 
├─ cp_async
├─ cublas
├─ cublaslt
├─ cuda
├─ cufft
├─ cupti
├─ curand
├─ curand_kernel
├─ cusolver
├─ cutensor
├─ debug
│  ├─ fp
│  └─ print
├─ device
├─ driver
├─ error
├─ event
├─ experimental
│  └─ fp
├─ graph
├─ math
├─ memory
├─ nvrtc
├─ type
│  └─ rounding
└─ thread

Smart pointers

Smart pointers Reference

CUDA Functions

cutf CUDA Functions Reference

cuBLAS Functions

cutf cuBLAS Functions Reference

cuSOLVER Functions

cutf cuSOLVER Functions Reference

NVRTC Functions

cutf NVRTC Functions Reference

Debug functions

cutf Debug Functions Reference

Experimental functions

cutf Experimental Functions Reference

License

Copyright (c) 2018 - 2021 tsuki (enp1s0) Released under the MIT license