cuda

package
v0.0.0-...-d0c3c69 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 12, 2013 License: GPL-3.0 Imports: 14 Imported by: 0

Documentation

Overview

CUDA functionality.

Index

Constants

View Source
const (
	MaxBlockSize = 512
	MaxGridSize  = 65535
)

CUDA Launch parameters. TODO: use device properties.

View Source
const CONV_TOLERANCE = 1e-6

Maximum tolerable error on demag convolution self-test.

View Source
const DEFAULT_KERNEL_ACC = 6

Default accuracy setting for demag kernel.

View Source
const FFT_IMAG_TOLERANCE = 1e-5

Maximum tolerable imaginary/real part for demag kernel in Fourier space. Assures kernel has correct symmetry.

View Source
const REDUCE_BLOCKSIZE = C.REDUCE_BLOCKSIZE

Block size for reduce kernels.

View Source
const STENCIL_BLOCKSIZE = C.STENCIL_BLOCKSIZE_X

Variables

View Source
var (
	Flag_gpu      = flag.Int("gpu", 0, "specify GPU")
	Flag_sched    = flag.String("sched", "auto", "CUDA scheduling: auto|spin|yield|sync")
	Flag_pagelock = flag.Bool("pagelock", true, "enable CUDA memeory page-locking")
)

Functions

func AddAnisoExchange

func AddAnisoExchange(Beff *data.Slice, m *data.Slice, AexX, AexY, AexZ, Msat float64)

Add exchange field to Beff with different exchange constant for X,Y,Z direction. m must be normalized to unit length.

func AddConst

func AddConst(dst *data.Slice, cnst ...float32)

Adds a constant to each element of the slice.

dst[comp][index] += cnst[comp]

func AddDMI

func AddDMI(Beff *data.Slice, m *data.Slice, D, Msat float64)

Add effective field of Dzyaloshinskii-Moriya interaction to Beff (Tesla). According to Bagdanov and Röβler, PRL 87, 3, 2001. eq.8 (out-of-plane symmetry breaking). m: normalized D: J/m²

func AddExchange

func AddExchange(Beff *data.Slice, m *data.Slice, Aex, Msat float64)

Add exchange field to Beff.

func AddUniaxialAnisotropy

func AddUniaxialAnisotropy(Beff, m *data.Slice, Kx, Ky, Kz, Msat float64)

Add uniaxial magnetocrystalline anisotropy field to Beff. m: normalized magnetization. K: anisotropy axis in J/m³

func AddZhangLiTorque

func AddZhangLiTorque(torque, m *data.Slice, j [3]float64, Msat float64, j_MsMap *data.Slice, alpha, xi float64)

func DampingTorque

func DampingTorque(torque, m, B *data.Slice)

Only the damping term of LLGTorque, with alpha 1. Useful for relaxation.

func GPUCopy

func GPUCopy(in *data.Slice) *data.Slice

Returns a copy of in, allocated on GPU.

func Init

func Init()

func LLGTorque

func LLGTorque(torque, m, B *data.Slice, alpha float32)

Landau-Lifshitz torque divided by gamma0:

  • 1/(1+α²) [ m x B + α (m/|m|) x (m x B) ] torque in Tesla/s m normalized B in Tesla

func LockThread

func LockThread()

LockCudaThread locks the current goroutine to an OS thread and sets the CUDA context for that thread. To be called by every fresh goroutine that will use CUDA.

func Madd2

func Madd2(dst, src1, src2 *data.Slice, factor1, factor2 float32)

multiply-add: dst[i] = src1[i] * factor1 + src2[i] * factor2

func Madd3

func Madd3(dst, src1, src2, src3 *data.Slice, factor1, factor2, factor3 float32)

multiply-add: dst[i] = src1[i] * factor1 + src2[i] * factor2 + src3 * factor3

func MaxAbs

func MaxAbs(in *data.Slice) float32

Maximum of absolute values of all elements.

func MaxVecDiff

func MaxVecDiff(x, y *data.Slice) float64

// Maximum of the norms of the difference between all vectors (x1,y1,z1) and (x2,y2,z2) // (dx, dy, dz) = (x1, y1, z1) - (x2, y2, z2) // max_i sqrt( dx[i]*dx[i] + dy[i]*dy[i] + dz[i]*dz[i] )

func MaxVecNorm

func MaxVecNorm(v *data.Slice) float64

Maximum of the norms of all vectors (x[i], y[i], z[i]).

max_i sqrt( x[i]*x[i] + y[i]*y[i] + z[i]*z[i] )

func Memset

func Memset(s *data.Slice, val ...float32)

Memset sets the Slice's components to the specified values.

func NewSlice

func NewSlice(nComp int, m *data.Mesh) *data.Slice

Make a GPU Slice with nComp components each of size length.

func NewSynced

func NewSynced(nComp int, m *data.Mesh) *data.Synced

func NewUnifiedSlice

func NewUnifiedSlice(nComp int, m *data.Mesh) *data.Slice

Make a GPU Slice with nComp components each of size length.

func Normalize

func Normalize(vec *data.Slice)

Normalize the vector field to length mask * norm. nil mask interpreted as 1s. 0-length vectors are unaffected.

func Sum

func Sum(in *data.Slice) float32

Sum of all elements.

func Zero

func Zero(s *data.Slice)

Set all elements of all components to zero.

Types

type DemagConvolution

type DemagConvolution struct {
	// contains filtered or unexported fields
}

func NewConvolution

func NewConvolution(mesh *data.Mesh, kernel [3][3]*data.Slice) *DemagConvolution

func NewDemag

func NewDemag(mesh *data.Mesh) *DemagConvolution

func (*DemagConvolution) Exec

func (c *DemagConvolution) Exec(outp, inp, vol *data.Slice, Bsat float64)

type Heun

type Heun struct {
	// contains filtered or unexported fields
}

Adaptive heun solver for vectors.

func NewHeun

func NewHeun(y *data.Synced, torqueFn func(bool) *data.Synced, postStep func(*data.Slice), dt, multiplier float64, time *float64) *Heun

func (*Heun) Step

func (e *Heun) Step()

Take one time step

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL