Skip to content

Commit

Permalink
checkpoint
Browse files Browse the repository at this point in the history
Signed-off by: David Rowenhorst <[email protected]>
  • Loading branch information
drowenhorst-nrl committed May 12, 2024
1 parent 4813839 commit 6cb5474
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 16 deletions.
16 changes: 9 additions & 7 deletions pyebsdindex/opencl/clnlpar.cl
Original file line number Diff line number Diff line change
Expand Up @@ -190,11 +190,13 @@ __kernel void normd(
long i, j;
long indx_j, indx_ij, count;

//long nnn = (2*nn+1) * (2*nn+1);
long nnn = (2*sr+1) * (2*sr+1);

float sigma_xy = sigma[indx_xy];
sigma_xy *= sigma_xy;
//printf("%f", sigma_xy);
float sigma_ij, nn, dd;

count = 0;
for(j=y-nn; j<=y+nn; ++j){

Expand All @@ -203,9 +205,9 @@ __kernel void normd(
indx_j = ncol * indx_j;

for(i=x-nn; i<=x+nn; ++i){
dd = d[count];
nn = n[count];
if (nn > 0){
dd = d[count+nnn*indx_xy];
nn = n[count+nnn*indx_xy];
if (nn > 1e-3){
indx_ij = (i >= 0) ? (i): abs(i);
indx_ij = (indx_ij < ncol) ? (indx_ij): ncol - (indx_ij -ncol +1);
indx_ij = (indx_ij + indx_j);
Expand All @@ -214,11 +216,11 @@ __kernel void normd(

sigma_ij = sigma_ij + sigma_xy;
dd -= nn*sigma_ij;
dd /= sigma_ij * sqrt(2.0*nn);
dd /= (sigma_ij * sqrt(2.0*nn));
//printf("%f\n", dd) ;
d[count] = dd;
count += 1;
d[count+nnn*indx_xy] = dd;
}
count += 1;
}

}
Expand Down
16 changes: 7 additions & 9 deletions pyebsdindex/opencl/nlpar_cl.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,10 @@ def d2normcl(d2, n2, sigmapad):

sigma, d2, n2 = self.calcsigma_cl(nn=1, saturation_protect=saturation_protect, automask=automask, normalize_d=True)

sigmapad = np.pad(sigma, 1, mode='reflect')
d2normcl(d2, n2, sigmapad)
#sigmapad = np.pad(sigma, 1, mode='reflect')
#d2normcl(d2, n2, sigmapad)

#print(d2.min(), d2.max(), d2.mean())
print(d2.min(), d2.max(), d2.mean())

lamopt_values_chnk = []
for tw in target_weights:
Expand Down Expand Up @@ -226,12 +226,10 @@ def calcsigma_cl(self,nn=1,saturation_protect=True,automask=True, normalize_d=Fa
np.int64(nn), np.int64(npatsteps), np.int64(npat_point),
np.float32(mxval) )


#cl.enqueue_barrier(queue)
# prg.normd(queue, (np.uint32(ncolchunk), np.uint32(nrowchunk)), None,
# sigmachunk_gpu,
# count_local, dist_local,
# np.int64(nn))
prg.normd(queue, (np.uint32(ncolchunk), np.uint32(nrowchunk)), None,
sigmachunk_gpu,
count_local, dist_local,
np.int64(nn))
queue.flush()

cl.enqueue_copy(queue, distchunk, dist_local, is_blocking=False)
Expand Down

0 comments on commit 6cb5474

Please sign in to comment.