46 |
46 |
#define EINSTEIN 0
|
47 |
47 |
#define NEWTON 1
|
48 |
48 |
|
|
49 |
#ifdef SETTRACKPOINTS
|
|
50 |
#define TRACKPOINTS SETTRACKPOINTS
|
|
51 |
#else
|
49 |
52 |
#define TRACKPOINTS 2048
|
|
53 |
#endif
|
50 |
54 |
|
51 |
55 |
float atanp(float x,float y)
|
52 |
56 |
{
|
... | ... | |
297 |
301 |
|
298 |
302 |
__kernel void Pixel(__global float *zImage,__global float *fImage,
|
299 |
303 |
__global float *Trajectories,__global int *IdLast,
|
300 |
|
uint ImpactParameter,uint TrackPoints,
|
|
304 |
uint ImpactParameter,
|
301 |
305 |
float Mass,float InternalRadius,
|
302 |
306 |
float ExternalRadius,float Angle,
|
303 |
307 |
int Line)
|
... | ... | |
329 |
333 |
bmx=1.25*re;
|
330 |
334 |
|
331 |
335 |
// Angular step of integration
|
332 |
|
h=4.e0f*PI/(float)TrackPoints;
|
|
336 |
h=4.e0f*PI/(float)TRACKPOINTS;
|
333 |
337 |
|
334 |
338 |
// Step of Impact Parameter
|
335 |
339 |
db=bmx/(2.e0*(float)ImpactParameter);
|
... | ... | |
360 |
364 |
|
361 |
365 |
if (ni<IdLast[bi])
|
362 |
366 |
{
|
363 |
|
r=(Trajectories[bi*TrackPoints+ni+1]-Trajectories[bi*TrackPoints+ni])*(nr-ni*1.)+Trajectories[bi*TrackPoints+ni];
|
|
367 |
r=(Trajectories[bi*TRACKPOINTS+ni+1]-Trajectories[bi*TRACKPOINTS+ni])*(nr-ni*1.)+Trajectories[bi*TRACKPOINTS+ni];
|
364 |
368 |
}
|
365 |
369 |
else
|
366 |
370 |
{
|
367 |
|
r=Trajectories[bi*TrackPoints+ni];
|
|
371 |
r=Trajectories[bi*TRACKPOINTS+ni];
|
368 |
372 |
}
|
369 |
373 |
|
370 |
374 |
if ((r<=re)&&(r>=ri))
|
... | ... | |
386 |
390 |
|
387 |
391 |
__kernel void Circle(__global float *Trajectories,__global int *IdLast,
|
388 |
392 |
__global float *zImage,__global float *fImage,
|
389 |
|
int TrackPoints,
|
390 |
393 |
float Mass,float InternalRadius,
|
391 |
394 |
float ExternalRadius,float Angle,
|
392 |
395 |
int Line)
|
... | ... | |
421 |
424 |
bmx=1.25*re;
|
422 |
425 |
|
423 |
426 |
// Angular step of integration
|
424 |
|
h=4.e0f*PI/(float)TrackPoints;
|
|
427 |
h=4.e0f*PI/(float)TRACKPOINTS;
|
425 |
428 |
|
426 |
429 |
// impact parameter
|
427 |
430 |
b=(float)bi/(float)bmaxi*bmx;
|
428 |
|
db=bmx/(2.e0*(float)bmaxi);
|
|
431 |
db=bmx/(2.e0f*(float)bmaxi);
|
429 |
432 |
|
430 |
433 |
phi=2.*PI/(float)imx*(float)i;
|
431 |
434 |
phd=atanp(cos(phi)*sin(tho),cos(tho));
|
... | ... | |
443 |
446 |
|
444 |
447 |
if (ni<IdLast[bi])
|
445 |
448 |
{
|
446 |
|
r=(Trajectories[bi*TrackPoints+ni+1]-Trajectories[bi*TrackPoints+ni])*(nr-ni*1.)+Trajectories[bi*TrackPoints+ni];
|
|
449 |
r=(Trajectories[bi*TRACKPOINTS+ni+1]-Trajectories[bi*TRACKPOINTS+ni])*(nr-ni*1.)+Trajectories[bi*TRACKPOINTS+ni];
|
447 |
450 |
}
|
448 |
451 |
else
|
449 |
452 |
{
|
450 |
|
r=Trajectories[bi*TrackPoints+ni];
|
|
453 |
r=Trajectories[bi*TRACKPOINTS+ni];
|
451 |
454 |
}
|
452 |
455 |
|
453 |
456 |
if ((r<=re)&&(r>=ri))
|
... | ... | |
466 |
469 |
|
467 |
470 |
}
|
468 |
471 |
|
469 |
|
__kernel void Trajectory(__global float *Trajectories,
|
470 |
|
__global int *IdLast,int TrackPoints,
|
|
472 |
__kernel void Trajectory(__global float *Trajectories,__global int *IdLast,
|
471 |
473 |
float Mass,float InternalRadius,
|
472 |
474 |
float ExternalRadius,float Angle,
|
473 |
475 |
int Line)
|
... | ... | |
479 |
481 |
|
480 |
482 |
// Perform trajectory for each pixel
|
481 |
483 |
|
|
484 |
float m,rs,re;
|
|
485 |
|
|
486 |
m=Mass;
|
|
487 |
rs=2.*m;
|
|
488 |
re=ExternalRadius;
|
|
489 |
|
|
490 |
float bmx,b,h;
|
|
491 |
int nh;
|
|
492 |
|
|
493 |
// Autosize for image
|
|
494 |
bmx=1.25*re;
|
|
495 |
|
|
496 |
// Angular step of integration
|
|
497 |
h=4.e0f*PI/(float)TRACKPOINTS;
|
|
498 |
|
|
499 |
// impact parameter
|
|
500 |
b=(float)bi/(float)bmaxi*bmx;
|
|
501 |
|
|
502 |
float up,vp,pp,us,vs,ps;
|
|
503 |
|
|
504 |
up=0.;
|
|
505 |
vp=1.;
|
|
506 |
|
|
507 |
pp=0.;
|
|
508 |
nh=0;
|
|
509 |
|
|
510 |
rungekutta(&ps,&us,&vs,pp,up,vp,h,m,b);
|
|
511 |
|
|
512 |
// b versus us
|
|
513 |
float bvus=fabs(b/us);
|
|
514 |
float bvus0=bvus;
|
|
515 |
Trajectories[bi*TRACKPOINTS+nh]=bvus;
|
|
516 |
|
|
517 |
do
|
|
518 |
{
|
|
519 |
nh++;
|
|
520 |
pp=ps;
|
|
521 |
up=us;
|
|
522 |
vp=vs;
|
|
523 |
rungekutta(&ps,&us,&vs,pp,up,vp,h,m,b);
|
|
524 |
bvus=fabs(b/us);
|
|
525 |
Trajectories[bi*TRACKPOINTS+nh]=bvus;
|
|
526 |
|
|
527 |
} while ((bvus>=rs)&&(bvus<=bvus0));
|
|
528 |
|
|
529 |
IdLast[bi]=nh;
|
|
530 |
|
|
531 |
barrier(CLK_GLOBAL_MEM_FENCE);
|
|
532 |
|
|
533 |
}
|
|
534 |
|
|
535 |
__kernel void Original(__global float *zImage,__global float *fImage,
|
|
536 |
float Mass,float InternalRadius,
|
|
537 |
float ExternalRadius,float Angle,
|
|
538 |
int Line)
|
|
539 |
{
|
|
540 |
// Integer Impact Parameter ID
|
|
541 |
int bi=get_global_id(0);
|
|
542 |
// Integer Impact Parameter Size (half of image)
|
|
543 |
int bmaxi=get_global_size(0);
|
|
544 |
|
|
545 |
float Trajectories[2048];
|
|
546 |
|
|
547 |
// Perform trajectory for each pixel
|
|
548 |
|
482 |
549 |
float m,rs,ri,re,tho;
|
483 |
550 |
int raie,q;
|
484 |
551 |
|
... | ... | |
490 |
557 |
q=-2;
|
491 |
558 |
raie=Line;
|
492 |
559 |
|
493 |
|
float d,bmx,db,b,h;
|
494 |
|
float phi,thi,phd,php,nr,r;
|
|
560 |
float bmx,db,b,h;
|
495 |
561 |
int nh;
|
496 |
|
float zp,fp;
|
497 |
562 |
|
498 |
563 |
// Autosize for image
|
499 |
|
bmx=1.25*re;
|
|
564 |
bmx=1.25e0f*re;
|
500 |
565 |
|
501 |
566 |
// Angular step of integration
|
502 |
|
h=4.e0f*PI/(float)TrackPoints;
|
|
567 |
h=4.e0f*PI/(float)TRACKPOINTS;
|
503 |
568 |
|
504 |
569 |
// impact parameter
|
505 |
570 |
b=(float)bi/(float)bmaxi*bmx;
|
|
571 |
db=bmx/(2.e0f*(float)bmaxi);
|
506 |
572 |
|
507 |
573 |
float up,vp,pp,us,vs,ps;
|
508 |
574 |
|
... | ... | |
517 |
583 |
// b versus us
|
518 |
584 |
float bvus=fabs(b/us);
|
519 |
585 |
float bvus0=bvus;
|
520 |
|
Trajectories[bi*TrackPoints+nh]=bvus;
|
|
586 |
Trajectories[nh]=bvus;
|
521 |
587 |
|
522 |
588 |
do
|
523 |
589 |
{
|
... | ... | |
527 |
593 |
vp=vs;
|
528 |
594 |
rungekutta(&ps,&us,&vs,pp,up,vp,h,m,b);
|
529 |
595 |
bvus=fabs(b/us);
|
530 |
|
Trajectories[bi*TrackPoints+nh]=bvus;
|
|
596 |
Trajectories[nh]=bvus;
|
531 |
597 |
|
532 |
598 |
} while ((bvus>=rs)&&(bvus<=bvus0));
|
533 |
599 |
|
534 |
|
IdLast[bi]=nh;
|
|
600 |
int imx=(int)(16*bi);
|
535 |
601 |
|
|
602 |
for (int i=0;i<imx;i++)
|
|
603 |
{
|
|
604 |
float zp=0,fp=0;
|
|
605 |
float phi=2.*PI/(float)imx*(float)i;
|
|
606 |
float phd=atanp(cos(phi)*sin(tho),cos(tho));
|
|
607 |
uint yi=(uint)((float)bi*sin(phi)+bmaxi);
|
|
608 |
uint xi=(uint)((float)bi*cos(phi)+bmaxi);
|
|
609 |
|
|
610 |
int HalfLap=0,ExitOnImpact=0,ni;
|
|
611 |
float php,nr,r;
|
|
612 |
|
|
613 |
do
|
|
614 |
{
|
|
615 |
php=phd+(float)HalfLap*PI;
|
|
616 |
nr=php/h;
|
|
617 |
ni=(int)nr;
|
|
618 |
|
|
619 |
if (ni<nh)
|
|
620 |
{
|
|
621 |
r=(Trajectories[ni+1]-Trajectories[ni])*(nr-ni*1.)+Trajectories[ni];
|
|
622 |
}
|
|
623 |
else
|
|
624 |
{
|
|
625 |
r=Trajectories[ni];
|
|
626 |
}
|
|
627 |
|
|
628 |
if ((r<=re)&&(r>=ri))
|
|
629 |
{
|
|
630 |
ExitOnImpact=1;
|
|
631 |
impact(phi,r,b,tho,m,&zp,&fp,q,db,h,raie);
|
|
632 |
}
|
|
633 |
|
|
634 |
HalfLap++;
|
|
635 |
|
|
636 |
} while ((HalfLap<=2)&&(ExitOnImpact==0));
|
|
637 |
|
|
638 |
zImage[yi+2*bmaxi*xi]=zp;
|
|
639 |
fImage[yi+2*bmaxi*xi]=fp;
|
|
640 |
|
|
641 |
}
|
|
642 |
|
536 |
643 |
barrier(CLK_GLOBAL_MEM_FENCE);
|
537 |
644 |
|
538 |
645 |
}
|
... | ... | |
547 |
654 |
#define EINSTEIN 0
|
548 |
655 |
#define NEWTON 1
|
549 |
656 |
|
550 |
|
#define TRACKPOINTS 2048
|
|
657 |
#ifdef SETTRACKPOINTS
|
|
658 |
#define TRACKPOINTS SETTRACKPOINTS
|
|
659 |
#else
|
|
660 |
#define TRACKPOINTS
|
|
661 |
#endif
|
551 |
662 |
|
552 |
663 |
__device__ float nothing(float x)
|
553 |
664 |
{
|
... | ... | |
804 |
915 |
|
805 |
916 |
__global__ void Pixel(float *zImage,float *fImage,
|
806 |
917 |
float *Trajectories,int *IdLast,
|
807 |
|
uint ImpactParameter,uint TrackPoints,
|
|
918 |
uint ImpactParameter,
|
808 |
919 |
float Mass,float InternalRadius,
|
809 |
920 |
float ExternalRadius,float Angle,
|
810 |
921 |
int Line)
|
... | ... | |
835 |
946 |
bmx=1.25*re;
|
836 |
947 |
|
837 |
948 |
// Angular step of integration
|
838 |
|
h=4.e0f*PI/(float)TrackPoints;
|
|
949 |
h=4.e0f*PI/(float)TRACKPOINTS;
|
839 |
950 |
|
840 |
951 |
// Step of Impact Parameter
|
841 |
952 |
db=bmx/(2.e0*(float)ImpactParameter);
|
... | ... | |
865 |
976 |
|
866 |
977 |
if (ni<IdLast[bi])
|
867 |
978 |
{
|
868 |
|
r=(Trajectories[bi*TrackPoints+ni+1]-Trajectories[bi*TrackPoints+ni])*(nr-ni*1.)+Trajectories[bi*TrackPoints+ni];
|
|
979 |
r=(Trajectories[bi*TRACKPOINTS+ni+1]-Trajectories[bi*TRACKPOINTS+ni])*(nr-ni*1.)+Trajectories[bi*TRACKPOINTS+ni];
|
869 |
980 |
}
|
870 |
981 |
else
|
871 |
982 |
{
|
872 |
|
r=Trajectories[bi*TrackPoints+ni];
|
|
983 |
r=Trajectories[bi*TRACKPOINTS+ni];
|
873 |
984 |
}
|
874 |
985 |
|
875 |
986 |
if ((r<=re)&&(r>=ri))
|
... | ... | |
889 |
1000 |
|
890 |
1001 |
__global__ void Circle(float *Trajectories,int *IdLast,
|
891 |
1002 |
float *zImage,float *fImage,
|
892 |
|
int TrackPoints,
|
893 |
1003 |
float Mass,float InternalRadius,
|
894 |
1004 |
float ExternalRadius,float Angle,
|
895 |
1005 |
int Line)
|
... | ... | |
924 |
1034 |
bmx=1.25*re;
|
925 |
1035 |
|
926 |
1036 |
// Angular step of integration
|
927 |
|
h=4.e0f*PI/(float)TrackPoints;
|
|
1037 |
h=4.e0f*PI/(float)TRACKPOINTS;
|
928 |
1038 |
|
929 |
1039 |
// impact parameter
|
930 |
1040 |
b=(float)bi/(float)bmaxi*bmx;
|
... | ... | |
946 |
1056 |
|
947 |
1057 |
if (ni<IdLast[bi])
|
948 |
1058 |
{
|
949 |
|
r=(Trajectories[bi*TrackPoints+ni+1]-Trajectories[bi*TrackPoints+ni])*(nr-ni*1.)+Trajectories[bi*TrackPoints+ni];
|
|
1059 |
r=(Trajectories[bi*TRACKPOINTS+ni+1]-Trajectories[bi*TRACKPOINTS+ni])*(nr-ni*1.)+Trajectories[bi*TRACKPOINTS+ni];
|
950 |
1060 |
}
|
951 |
1061 |
else
|
952 |
1062 |
{
|
953 |
|
r=Trajectories[bi*TrackPoints+ni];
|
|
1063 |
r=Trajectories[bi*TRACKPOINTS+ni];
|
954 |
1064 |
}
|
955 |
1065 |
|
956 |
1066 |
if ((r<=re)&&(r>=ri))
|
... | ... | |
967 |
1077 |
|
968 |
1078 |
}
|
969 |
1079 |
|
970 |
|
__global__ void Trajectory(float *Trajectories,
|
971 |
|
int *IdLast,int TrackPoints,
|
|
1080 |
__global__ void Trajectory(float *Trajectories,int *IdLast,
|
972 |
1081 |
float Mass,float InternalRadius,
|
973 |
1082 |
float ExternalRadius,float Angle,
|
974 |
1083 |
int Line)
|
... | ... | |
1000 |
1109 |
bmx=1.25*re;
|
1001 |
1110 |
|
1002 |
1111 |
// Angular step of integration
|
1003 |
|
h=4.e0f*PI/(float)TrackPoints;
|
|
1112 |
h=4.e0f*PI/(float)TRACKPOINTS;
|
1004 |
1113 |
|
1005 |
1114 |
// impact parameter
|
1006 |
1115 |
b=(float)bi/(float)bmaxi*bmx;
|
... | ... | |
1018 |
1127 |
// b versus us
|
1019 |
1128 |
float bvus=fabs(b/us);
|
1020 |
1129 |
float bvus0=bvus;
|
1021 |
|
Trajectories[bi*TrackPoints+nh]=bvus;
|
|
1130 |
Trajectories[bi*TRACKPOINTS+nh]=bvus;
|
1022 |
1131 |
|
1023 |
1132 |
do
|
1024 |
1133 |
{
|
... | ... | |
1028 |
1137 |
vp=vs;
|
1029 |
1138 |
rungekutta(&ps,&us,&vs,pp,up,vp,h,m,b);
|
1030 |
1139 |
bvus=fabs(b/us);
|
1031 |
|
Trajectories[bi*TrackPoints+nh]=bvus;
|
|
1140 |
Trajectories[bi*TRACKPOINTS+nh]=bvus;
|
1032 |
1141 |
|
1033 |
1142 |
} while ((bvus>=rs)&&(bvus<=bvus0));
|
1034 |
1143 |
|
1035 |
1144 |
IdLast[bi]=nh;
|
1036 |
1145 |
|
1037 |
1146 |
}
|
|
1147 |
|
|
1148 |
__global__ void Original(float *zImage,float *fImage,
|
|
1149 |
float Mass,float InternalRadius,
|
|
1150 |
float ExternalRadius,float Angle,
|
|
1151 |
int Line)
|
|
1152 |
{
|
|
1153 |
// Integer Impact Parameter ID
|
|
1154 |
int bi=blockIdx.x*blockDim.x+threadIdx.x;
|
|
1155 |
|
|
1156 |
// Integer Impact Parameter Size (half of image)
|
|
1157 |
int bmaxi=gridDim.x*blockDim.x;
|
|
1158 |
|
|
1159 |
float Trajectories[2048];
|
|
1160 |
|
|
1161 |
// Perform trajectory for each pixel
|
|
1162 |
|
|
1163 |
float m,rs,ri,re,tho;
|
|
1164 |
int raie,q;
|
|
1165 |
|
|
1166 |
m=Mass;
|
|
1167 |
rs=2.*m;
|
|
1168 |
ri=InternalRadius;
|
|
1169 |
re=ExternalRadius;
|
|
1170 |
tho=Angle;
|
|
1171 |
q=-2;
|
|
1172 |
raie=Line;
|
|
1173 |
|
|
1174 |
float bmx,db,b,h;
|
|
1175 |
int nh;
|
|
1176 |
|
|
1177 |
// Autosize for image
|
|
1178 |
bmx=1.25e0f*re;
|
|
1179 |
|
|
1180 |
// Angular step of integration
|
|
1181 |
h=4.e0f*PI/(float)TRACKPOINTS;
|
|
1182 |
|
|
1183 |
// impact parameter
|
|
1184 |
b=(float)bi/(float)bmaxi*bmx;
|
|
1185 |
db=bmx/(2.e0f*(float)bmaxi);
|
|
1186 |
|
|
1187 |
float up,vp,pp,us,vs,ps;
|
|
1188 |
|
|
1189 |
up=0.;
|
|
1190 |
vp=1.;
|
|
1191 |
|
|
1192 |
pp=0.;
|
|
1193 |
nh=0;
|
|
1194 |
|
|
1195 |
rungekutta(&ps,&us,&vs,pp,up,vp,h,m,b);
|
|
1196 |
|
|
1197 |
// b versus us
|
|
1198 |
float bvus=fabs(b/us);
|
|
1199 |
float bvus0=bvus;
|
|
1200 |
Trajectories[nh]=bvus;
|
|
1201 |
|
|
1202 |
do
|
|
1203 |
{
|
|
1204 |
nh++;
|
|
1205 |
pp=ps;
|
|
1206 |
up=us;
|
|
1207 |
vp=vs;
|
|
1208 |
rungekutta(&ps,&us,&vs,pp,up,vp,h,m,b);
|
|
1209 |
bvus=fabs(b/us);
|
|
1210 |
Trajectories[nh]=bvus;
|
|
1211 |
|
|
1212 |
} while ((bvus>=rs)&&(bvus<=bvus0));
|
|
1213 |
|
|
1214 |
int imx=(int)(16*bi);
|
|
1215 |
|
|
1216 |
for (int i=0;i<imx;i++)
|
|
1217 |
{
|
|
1218 |
float zp=0,fp=0;
|
|
1219 |
float phi=2.*PI/(float)imx*(float)i;
|
|
1220 |
float phd=atanp(cos(phi)*sin(tho),cos(tho));
|
|
1221 |
uint yi=(uint)((float)bi*sin(phi)+bmaxi);
|
|
1222 |
uint xi=(uint)((float)bi*cos(phi)+bmaxi);
|
|
1223 |
|
|
1224 |
int HalfLap=0,ExitOnImpact=0,ni;
|
|
1225 |
float php,nr,r;
|
|
1226 |
|
|
1227 |
do
|
|
1228 |
{
|
|
1229 |
php=phd+(float)HalfLap*PI;
|
|
1230 |
nr=php/h;
|
|
1231 |
ni=(int)nr;
|
|
1232 |
|
|
1233 |
if (ni<nh)
|
|
1234 |
{
|
|
1235 |
r=(Trajectories[ni+1]-Trajectories[ni])*(nr-ni*1.)+Trajectories[ni];
|
|
1236 |
}
|
|
1237 |
else
|
|
1238 |
{
|
|
1239 |
r=Trajectories[ni];
|
|
1240 |
}
|
|
1241 |
|
|
1242 |
if ((r<=re)&&(r>=ri))
|
|
1243 |
{
|
|
1244 |
ExitOnImpact=1;
|
|
1245 |
impact(phi,r,b,tho,m,&zp,&fp,q,db,h,raie);
|
|
1246 |
}
|
|
1247 |
|
|
1248 |
HalfLap++;
|
|
1249 |
|
|
1250 |
} while ((HalfLap<=2)&&(ExitOnImpact==0));
|
|
1251 |
|
|
1252 |
__syncthreads();
|
|
1253 |
|
|
1254 |
zImage[yi+2*bmaxi*xi]=zp;
|
|
1255 |
fImage[yi+2*bmaxi*xi]=fp;
|
|
1256 |
|
|
1257 |
}
|
|
1258 |
|
|
1259 |
}
|
1038 |
1260 |
"""
|
1039 |
1261 |
return(BlobCUDA)
|
1040 |
1262 |
|
... | ... | |
1110 |
1332 |
|
1111 |
1333 |
# BlackHoleCL = cl.Program(ctx,KERNEL_CODE.substitute(kernel_params)).build()
|
1112 |
1334 |
|
1113 |
|
BuildOptions="-cl-mad-enable -DPHYSICS=%i " % (PhysicsList[Physics])
|
|
1335 |
BuildOptions="-cl-mad-enable -DPHYSICS=%i -DSETTRACKPOINTS=%i " % (PhysicsList[Physics],InputCL['TrackPoints'])
|
1114 |
1336 |
|
1115 |
1337 |
BlackHoleCL = cl.Program(ctx,BlobOpenCL).build(options = BuildOptions)
|
1116 |
1338 |
|
... | ... | |
1133 |
1355 |
numpy.float32(Angle),
|
1134 |
1356 |
numpy.int32(Line))
|
1135 |
1357 |
CLLaunch.wait()
|
|
1358 |
elif Method=='Original':
|
|
1359 |
CLLaunch=BlackHoleCL.Original(queue,(zImage.shape[0]/2,),
|
|
1360 |
None,zImageCL,fImageCL,
|
|
1361 |
numpy.float32(Mass),
|
|
1362 |
numpy.float32(InternalRadius),
|
|
1363 |
numpy.float32(ExternalRadius),
|
|
1364 |
numpy.float32(Angle),
|
|
1365 |
numpy.int32(Line))
|
|
1366 |
CLLaunch.wait()
|
1136 |
1367 |
elif Method=='TrajectoCircle':
|
1137 |
1368 |
CLLaunch=BlackHoleCL.Trajectory(queue,(Trajectories.shape[0],),
|
1138 |
1369 |
None,TrajectoriesCL,IdLastCL,
|
1139 |
|
numpy.uint32(Trajectories.shape[1]),
|
1140 |
1370 |
numpy.float32(Mass),
|
1141 |
1371 |
numpy.float32(InternalRadius),
|
1142 |
1372 |
numpy.float32(ExternalRadius),
|
... | ... | |
1147 |
1377 |
zImage.shape[0]*4),None,
|
1148 |
1378 |
TrajectoriesCL,IdLastCL,
|
1149 |
1379 |
zImageCL,fImageCL,
|
1150 |
|
numpy.uint32(Trajectories.shape[1]),
|
1151 |
1380 |
numpy.float32(Mass),
|
1152 |
1381 |
numpy.float32(InternalRadius),
|
1153 |
1382 |
numpy.float32(ExternalRadius),
|
... | ... | |
1157 |
1386 |
else:
|
1158 |
1387 |
CLLaunch=BlackHoleCL.Trajectory(queue,(Trajectories.shape[0],),
|
1159 |
1388 |
None,TrajectoriesCL,IdLastCL,
|
1160 |
|
numpy.uint32(Trajectories.shape[1]),
|
1161 |
1389 |
numpy.float32(Mass),
|
1162 |
1390 |
numpy.float32(InternalRadius),
|
1163 |
1391 |
numpy.float32(ExternalRadius),
|
... | ... | |
1168 |
1396 |
zImage.shape[1]),None,
|
1169 |
1397 |
zImageCL,fImageCL,TrajectoriesCL,IdLastCL,
|
1170 |
1398 |
numpy.uint32(Trajectories.shape[0]),
|
1171 |
|
numpy.uint32(Trajectories.shape[1]),
|
1172 |
1399 |
numpy.float32(Mass),
|
1173 |
1400 |
numpy.float32(InternalRadius),
|
1174 |
1401 |
numpy.float32(ExternalRadius),
|
... | ... | |
1246 |
1473 |
Context=XPU.make_context()
|
1247 |
1474 |
|
1248 |
1475 |
try:
|
1249 |
|
mod = SourceModule(KernelCodeCuda(),options=['--compiler-options','-DPHYSICS=%i' % (PhysicsList[Physics])])
|
|
1476 |
mod = SourceModule(KernelCodeCuda(),options=['--compiler-options','-DPHYSICS=%i -DSETTRACKPOINTS=%i' % (PhysicsList[Physics],TrackPoints)])
|
1250 |
1477 |
print("Compilation seems to be OK")
|
1251 |
1478 |
except:
|
1252 |
1479 |
print("Compilation seems to break")
|
1253 |
1480 |
|
1254 |
1481 |
EachPixelCU=mod.get_function("EachPixel")
|
|
1482 |
OriginalCU=mod.get_function("Original")
|
1255 |
1483 |
TrajectoryCU=mod.get_function("Trajectory")
|
1256 |
1484 |
PixelCU=mod.get_function("Pixel")
|
1257 |
1485 |
CircleCU=mod.get_function("Circle")
|
... | ... | |
1276 |
1504 |
numpy.int32(Line),
|
1277 |
1505 |
grid=(zImage.shape[0]/32,zImage.shape[1]/32),
|
1278 |
1506 |
block=(32,32,1))
|
|
1507 |
elif Method=='Original':
|
|
1508 |
OriginalCU(zImageCU,fImageCU,
|
|
1509 |
numpy.float32(Mass),
|
|
1510 |
numpy.float32(InternalRadius),
|
|
1511 |
numpy.float32(ExternalRadius),
|
|
1512 |
numpy.float32(Angle),
|
|
1513 |
numpy.int32(Line),
|
|
1514 |
grid=(zImage.shape[0]/32/2,1),
|
|
1515 |
block=(32,1,1))
|
1279 |
1516 |
elif Method=='TrajectoCircle':
|
1280 |
1517 |
TrajectoryCU(TrajectoriesCU,IdLastCU,
|
1281 |
|
numpy.uint32(Trajectories.shape[1]),
|
1282 |
1518 |
numpy.float32(Mass),
|
1283 |
1519 |
numpy.float32(InternalRadius),
|
1284 |
1520 |
numpy.float32(ExternalRadius),
|
... | ... | |
1288 |
1524 |
block=(32,1,1))
|
1289 |
1525 |
|
1290 |
1526 |
CircleCU(TrajectoriesCU,IdLastCU,zImageCU,fImageCU,
|
1291 |
|
numpy.uint32(Trajectories.shape[1]),
|
1292 |
1527 |
numpy.float32(Mass),
|
1293 |
1528 |
numpy.float32(InternalRadius),
|
1294 |
1529 |
numpy.float32(ExternalRadius),
|
... | ... | |
1298 |
1533 |
block=(32,32,1))
|
1299 |
1534 |
else:
|
1300 |
1535 |
TrajectoryCU(TrajectoriesCU,IdLastCU,
|
1301 |
|
numpy.uint32(Trajectories.shape[1]),
|
1302 |
1536 |
numpy.float32(Mass),
|
1303 |
1537 |
numpy.float32(InternalRadius),
|
1304 |
1538 |
numpy.float32(ExternalRadius),
|
... | ... | |
1309 |
1543 |
|
1310 |
1544 |
PixelCU(zImageCU,fImageCU,TrajectoriesCU,IdLastCU,
|
1311 |
1545 |
numpy.uint32(Trajectories.shape[0]),
|
1312 |
|
numpy.uint32(Trajectories.shape[1]),
|
1313 |
1546 |
numpy.float32(Mass),
|
1314 |
1547 |
numpy.float32(InternalRadius),
|
1315 |
1548 |
numpy.float32(ExternalRadius),
|
... | ... | |
1368 |
1601 |
# No output as image
|
1369 |
1602 |
NoImage = False
|
1370 |
1603 |
|
1371 |
|
HowToUse='%s -h [Help] -b [BlackBodyEmission] -n [NoImage] -p <Einstein/Newton> -s <SizeInPixels> -m <Mass> -i <DiscInternalRadius> -x <DiscExternalRadius> -a <AngleAboveDisc> -d <DeviceId> -c <Greyscale/Red2Yellow> -g <CUDA/OpenCL> -t <EachPixel/TrajectoCircle/TrajectoPixel> -v <FP32/FP64>'
|
|
1604 |
HowToUse='%s -h [Help] -b [BlackBodyEmission] -n [NoImage] -p <Einstein/Newton> -s <SizeInPixels> -m <Mass> -i <DiscInternalRadius> -x <DiscExternalRadius> -a <AngleAboveDisc> -d <DeviceId> -c <Greyscale/Red2Yellow> -g <CUDA/OpenCL> -t <EachPixel/TrajectoCircle/TrajectoPixel/Original> -v <FP32/FP64>'
|
1372 |
1605 |
|
1373 |
1606 |
try:
|
1374 |
1607 |
opts, args = getopt.getopt(sys.argv[1:],"hbns:m:i:x:a:d:g:v:t:c:p:",["blackbody","noimage","camera","size=","mass=","internal=","external=","angle=","device=","gpustyle=","variabletype=","method=","colors=","physics="])
|