P-1 factoring with cuda, anybody? :P

This is my first tentative, it can not handle numbers higher then 64 bits in an efficient manner, and there are lots and lots of things I don't know, about both cuda and the math... but I am learning...

Here is what you can get with a B1 up to 10k, and a B2 about 100 times larger, and if no factor is found after that, I still do a couple of squares (what is shown as stage 2b) so, first is the exponent (below 400), second is the factor found. Note that the factors may be composite (for such a small exponents the bounds are too large).

Code:

2 :: No factor. Try increasing the bound.
3 :: No factor. Try increasing the bound.
5 :: No factor. Try increasing the bound.
7 :: No factor. Try increasing the bound.
11 :: 23 is a factor in stage 2a.
13 :: No factor. Try increasing the bound.
17 :: No factor. Try increasing the bound.
19 :: No factor. Try increasing the bound.
23 :: 47 is a factor in stage 1.
29 :: 1103 is a factor in stage 1.
31 :: No factor. Try increasing the bound.
37 :: 223 is a factor in stage 2a.
41 :: 13367 is a factor in stage 1.
43 :: 2099863 is a factor in stage 1.
47 :: 2351 is a factor in stage 1.
53 :: 69431 is a factor in stage 1.
59 :: 179951 is a factor in stage 2a.
61 :: No factor. Try increasing the bound.
67 :: 761838257287 is a factor in stage 2a.
71 :: 212885833 is a factor in stage 1.
73 :: 439 is a factor in stage 1.
79 :: 2687 is a factor in stage 1.
83 :: 167 is a factor in stage 2a.
89 :: No factor. Try increasing the bound.
97 :: 11447 is a factor in stage 2a.
101 :: No factor. Try increasing the bound.
103 :: 2550183799 is a factor in stage 1.
107 :: No factor. Try increasing the bound.
109 :: 745988807 is a factor in stage 2a.
113 :: 78939089 is a factor in stage 1.
127 :: No factor. Try increasing the bound.
131 :: 263 is a factor in stage 1.
137 :: No factor. Try increasing the bound.
139 :: 5625767248687 is a factor in stage 2a.
149 :: No factor. Try increasing the bound.
151 :: 165799 is a factor in stage 1.
157 :: 852133201 is a factor in stage 2b.
163 :: 150287 is a factor in stage 1.
167 :: 2349023 is a factor in stage 2a.
173 :: 1505447 is a factor in stage 1.
179 :: 359 is a factor in stage 2a.
181 :: 43441 is a factor in stage 2a.
191 :: 383 is a factor in stage 1.
193 :: 13821503 is a factor in stage 1.
197 :: 7487 is a factor in stage 1.
199 :: No factor. Try increasing the bound.
211 :: 15193 is a factor in stage 2b.
223 :: 196687 is a factor in stage 1.
227 :: No factor. Try increasing the bound.
229 :: 20492753 is a factor in stage 1.
233 :: 189714193 is a factor in stage 2a.
239 :: 84487457 is a factor in stage 1.
241 :: 22000409 is a factor in stage 2a.
251 :: 503 is a factor in stage 2a.
257 :: No factor. Try increasing the bound.
263 :: 23671 is a factor in stage 2a.
269 :: 13822297 is a factor in stage 2a.
271 :: 15242475217 is a factor in stage 2b.
277 :: 1121297 is a factor in stage 2b.
281 :: 80929 is a factor in stage 2b.
283 :: 9623 is a factor in stage 1.
293 :: No factor. Try increasing the bound.
307 :: 14608903 is a factor in stage 1.
311 :: 5344847 is a factor in stage 2a.
313 :: 10960009 is a factor in stage 2a.
317 :: 9511 is a factor in stage 1.
331 :: No factor. Try increasing the bound.
337 :: 18199 is a factor in stage 1.
347 :: No factor. Try increasing the bound.
349 :: No factor. Try increasing the bound.
353 :: 931921 is a factor in stage 2b.
359 :: 719 is a factor in stage 2a.
367 :: 12479 is a factor in stage 2a.
373 :: 25569151 is a factor in stage 1.
379 :: 180818808679 is a factor in stage 1.
383 :: 1440847 is a factor in stage 2a.
389 :: 269160341965838569 is a factor in stage 2a.
397 :: 202471 is a factor in stage 1.