-
Notifications
You must be signed in to change notification settings - Fork 155
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add relative error check in adaptive time stepping algorithm for rk23…
…, rk45dp and rk56 time steppers
- Loading branch information
Showing
6 changed files
with
174 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#include "float3.h" | ||
|
||
// dst = sqrt(ax*ax + ay*ay + az*az) | ||
extern "C" __global__ void | ||
vecnorm(float* __restrict__ dst, | ||
float* __restrict__ ax, float* __restrict__ ay, float* __restrict__ az, | ||
int N) { | ||
|
||
int i = ( blockIdx.y*gridDim.x + blockIdx.x ) * blockDim.x + threadIdx.x; | ||
if (i < N) { | ||
float3 A = {ax[i], ay[i], az[i]}; | ||
dst[i] = sqrtf(dot(A, A)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package cuda | ||
|
||
import ( | ||
"github.com/mumax/3/data" | ||
"github.com/mumax/3/util" | ||
) | ||
|
||
// dst = sqrt(dot(a, a)), | ||
func VecNorm(dst *data.Slice, a *data.Slice) { | ||
util.Argument(dst.NComp() == 1 && a.NComp() == 3) | ||
util.Argument(dst.Len() == a.Len()) | ||
|
||
N := dst.Len() | ||
cfg := make1DConf(N) | ||
k_vecnorm_async(dst.DevPtr(0), | ||
a.DevPtr(X), a.DevPtr(Y), a.DevPtr(Z), | ||
N, cfg) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters