interface_c_kernel.F90 37.7 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
!    This file is part of ELPA.
!
!    The ELPA library was originally created by the ELPA consortium,
!    consisting of the following organizations:
!
!    - Rechenzentrum Garching der Max-Planck-Gesellschaft (RZG),
!    - Bergische Universität Wuppertal, Lehrstuhl für angewandte
!      Informatik,
!    - Technische Universität München, Lehrstuhl für Informatik mit
!      Schwerpunkt Wissenschaftliches Rechnen ,
!    - Fritz-Haber-Institut, Berlin, Abt. Theorie,
12
!    - Max-Plack-Institut für Mathematik in den Naturwissenschaften,
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
!      Leipzig, Abt. Komplexe Strukutren in Biologie und Kognition,
!      and
!    - IBM Deutschland GmbH
!
!
!    More information can be found here:
!    http://elpa.rzg.mpg.de/
!
!    ELPA is free software: you can redistribute it and/or modify
!    it under the terms of the version 3 of the license of the
!    GNU Lesser General Public License as published by the Free
!    Software Foundation.
!
!    ELPA is distributed in the hope that it will be useful,
!    but WITHOUT ANY WARRANTY; without even the implied warranty of
!    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
!    GNU Lesser General Public License for more details.
!
!    You should have received a copy of the GNU Lesser General Public License
!    along with ELPA.  If not, see <http://www.gnu.org/licenses/>
!
!    ELPA reflects a substantial effort on the part of the original
!    ELPA consortium, and we ask you to respect the spirit of the
!    license that we chose: i.e., please contribute any changes you
!    may have back to the original ELPA library distribution, and keep
!    any derivatives of ELPA under the same license that we chose for
!    the original distribution, the GNU Lesser General Public License.

!This is a module contains all CUDA C Calls
! it was provided by NVIDIA with their ELPA GPU port and
! adapted for an ELPA release by A.Marek, RZG

#include "config-f90.h"

module cuda_c_kernel
  implicit none

Andreas Marek's avatar
Andreas Marek committed
50
#if 0 /* not used anywhere */
51
  interface
Andreas Marek's avatar
Andreas Marek committed
52
53
    subroutine launch_dot_product_kernel_c_complex_double(hs_dev, hv_new_dev, tau_new, x_dev, h_dev,hv_dev, nr) &
               bind(c,name="launch_dot_product_kernel_complex_double")
54
      use precision
55
56
57
58
59
      use iso_c_binding

      implicit none
      integer(kind=c_int), value      :: nr
      integer(kind=C_intptr_T), value :: hs_dev ,hv_new_dev,x_dev,h_dev, hv_dev
60
      complex(kind=ck8),value         :: tau_new
61
62
63

    end subroutine
  end interface
64

65
#ifdef WANT_SINGLE_PRECISION_COMPLEX
66
  interface
Andreas Marek's avatar
Andreas Marek committed
67
68
    subroutine launch_dot_product_kernel_c_complex_single(hs_dev, hv_new_dev, tau_new, x_dev, h_dev,hv_dev, nr) &
               bind(c,name="launch_dot_product_kernel_complex_single")
69
70
71
72
73
74
75
76
77
78
79
80
81
      use precision
      use iso_c_binding

      implicit none
      integer(kind=c_int), value      :: nr
      integer(kind=C_intptr_T), value :: hs_dev ,hv_new_dev,x_dev,h_dev, hv_dev
      complex(kind=ck4),value         :: tau_new

    end subroutine
  end interface

#endif

Andreas Marek's avatar
Andreas Marek committed
82
83
84
85
#endif /* not used anywhere */

#if 0 /* not used anywhere */

86
  interface
Andreas Marek's avatar
Andreas Marek committed
87
88
    subroutine launch_dot_product_kernel_1_c_complex_double(ab_dev, hs_dev, hv_new_dev, x_dev,h_dev,hv_dev,nb, nr, ns) &
               bind(c, name="launch_dot_product_kernel_1_complex_double")
89
90
91
92

      use iso_c_binding

      implicit none
93
94
      integer(kind=c_int), value        ::  nb, nr, ns
      integer(kind=C_intptr_T), value   :: x_dev,h_dev, hv_dev, ab_dev, hs_dev,hv_new_dev
95
96

    end subroutine
97
  end interface
98

99
100
#ifdef WANT_SINGLE_PRECISION_COMPLEX

101
  interface
Andreas Marek's avatar
Andreas Marek committed
102
103
    subroutine launch_dot_product_kernel_1_c_complex_single(ab_dev, hs_dev, hv_new_dev, x_dev,h_dev,hv_dev,nb, nr, ns) &
               bind(c, name="launch_dot_product_kernel_1_complex_single")
104
105
106
107
108
109
110
111
112
113
114

      use iso_c_binding

      implicit none
      integer(kind=c_int), value        ::  nb, nr, ns
      integer(kind=C_intptr_T), value   :: x_dev,h_dev, hv_dev, ab_dev, hs_dev,hv_new_dev

    end subroutine
  end interface

#endif
Andreas Marek's avatar
Andreas Marek committed
115
116
117
#endif /* not used anywhere */

#if 0 /* not used anywhere */
118
119

  interface
Andreas Marek's avatar
Andreas Marek committed
120
121
    subroutine launch_dot_product_kernel_2_c_complex_double(ab_dev, hs_dev, hv_dev,hd_dev,nb, nr, ne) &
                bind(c,name="launch_dot_product_kernel_2_complex_double")
122
123
124
125

      use iso_c_binding

      implicit none
126
127
      integer(kind=c_int), value      ::  nb, nr, ne
      integer(kind=C_intptr_T), value :: hd_dev,hv_dev, hs_dev, ab_dev
128
129

    end subroutine
130
  end interface
131

132
133
#ifdef WANT_SINGLE_PRECISION_COMPLEX

134
  interface
Andreas Marek's avatar
Andreas Marek committed
135
136
    subroutine launch_dot_product_kernel_2_c_complex_single(ab_dev, hs_dev, hv_dev,hd_dev,nb, nr, ne) &
                bind(c,name="launch_dot_product_kernel_2_complex_single")
137
138
139
140
141
142
143
144
145
146
147

      use iso_c_binding

      implicit none
      integer(kind=c_int), value      ::  nb, nr, ne
      integer(kind=C_intptr_T), value :: hd_dev,hv_dev, hs_dev, ab_dev

    end subroutine
  end interface

#endif
Andreas Marek's avatar
Andreas Marek committed
148
#endif /* not used anywhere */
149

Andreas Marek's avatar
Andreas Marek committed
150
#if 0 /* not used anywhere */
151
  interface
Andreas Marek's avatar
Andreas Marek committed
152
153
    subroutine launch_double_hh_transform_1_c_complex_double(ab_dev, hs_dev,hv_dev,nb,ns) &
               bind(c,name="launch_double_hh_transform_1_complex_double")
154
155
156
157
158
159
160
161
162
163
164
165
166

      use iso_c_binding

      implicit none
      integer(kind=c_int), value      ::  nb, ns
      integer(kind=C_intptr_T), value :: hv_dev, ab_dev,hs_dev

    end subroutine
  end interface

#ifdef WANT_SINGLE_PRECISION_COMPLEX

  interface
Andreas Marek's avatar
Andreas Marek committed
167
168
    subroutine launch_double_hh_transform_1_c_complex_single(ab_dev, hs_dev,hv_dev,nb,ns) &
               bind(c,name="launch_double_hh_transform_1_complex_single")
169
170
171
172

      use iso_c_binding

      implicit none
173
174
      integer(kind=c_int), value      ::  nb, ns
      integer(kind=C_intptr_T), value :: hv_dev, ab_dev,hs_dev
175
176

    end subroutine
177
  end interface
178

179
#endif
Andreas Marek's avatar
Andreas Marek committed
180
#endif /* not used anywhere */
181

Andreas Marek's avatar
Andreas Marek committed
182
#if 0 /* not used anywhere */
183
  interface
Andreas Marek's avatar
Andreas Marek committed
184
185
    subroutine launch_double_hh_transform_2_c_complex_double(ab_dev, hd_dev,hv_dev,nc,ns, nb) &
               bind(c,name="launch_double_hh_transform_2_complex_double")
186
187
188
189
190
191
192
193
194
195
196

      use iso_c_binding

      implicit none
      integer(kind=c_int), value      ::  nc, ns, nb
      integer(kind=C_intptr_T), value :: hv_dev, ab_dev,hd_dev
    end subroutine
  end interface

#ifdef WANT_SINGLE_PRECISION_COMPLEX

197
  interface
Andreas Marek's avatar
Andreas Marek committed
198
199
    subroutine launch_double_hh_transform_2_c_complex_single(ab_dev, hd_dev,hv_dev,nc,ns, nb) &
               bind(c,name="launch_double_hh_transform_2_complex_single")
200
201
202
203

      use iso_c_binding

      implicit none
204
205
206
207
208
      integer(kind=c_int), value      ::  nc, ns, nb
      integer(kind=C_intptr_T), value :: hv_dev, ab_dev,hd_dev
    end subroutine
  end interface

209
#endif
Andreas Marek's avatar
Andreas Marek committed
210
#endif /* not used anywhere */
211

Andreas Marek's avatar
Andreas Marek committed
212
#if 0 /* not used anywhere */
213
  interface
Andreas Marek's avatar
Andreas Marek committed
214
215
    subroutine launch_compute_kernel_reduce_c_complex_double(a_dev, lda, n, nbw, h1_dev) &
               bind(c,name="launch_compute_kernel_reduce_complex_double")
216

217
218
219
220
221
      use iso_c_binding

      implicit none
      integer(kind=c_int), value      :: n,lda,nbw
      integer(kind=C_intptr_T), value :: h1_dev ,a_dev
222
    end subroutine
223
  end interface
224

225
226
#ifdef WANT_SINGLE_PRECISION_COMPLEX

227
  interface
Andreas Marek's avatar
Andreas Marek committed
228
229
    subroutine launch_compute_kernel_reduce_c_complex_single(a_dev, lda, n, nbw, h1_dev) &
               bind(c,name="launch_compute_kernel_reduce_complex_single")
230
231
232
233
234
235
236
237
238

      use iso_c_binding

      implicit none
      integer(kind=c_int), value      :: n,lda,nbw
      integer(kind=C_intptr_T), value :: h1_dev ,a_dev
    end subroutine
  end interface
#endif
Andreas Marek's avatar
Andreas Marek committed
239
#endif /* not used anywhere */
240

Andreas Marek's avatar
Andreas Marek committed
241
#if 0 /* not used anywhere */
242
  interface
Andreas Marek's avatar
Andreas Marek committed
243
244
    subroutine launch_compute_kernel_reduce_1_c_complex_double(a_dev, lda, n, h1_dev) &
               bind(c,name="launch_compute_kernel_reduce_1_complex_double")
245

246
      use iso_c_binding
247

248
249
250
      implicit none
      integer(kind=c_int), value      :: n,lda
      integer(kind=C_intptr_T), value :: h1_dev ,a_dev
251

252
253
    end subroutine
  end interface
254

255
256
#ifdef WANT_SINGLE_PRECISION_COMPLEX
  interface
Andreas Marek's avatar
Andreas Marek committed
257
258
    subroutine launch_compute_kernel_reduce_1_c_complex_single(a_dev, lda, n, h1_dev) &
               bind(c,name="launch_compute_kernel_reduce_1_complex_single")
259
260
261
262
263
264
265
266
267
268

      use iso_c_binding

      implicit none
      integer(kind=c_int), value      :: n,lda
      integer(kind=C_intptr_T), value :: h1_dev ,a_dev

    end subroutine
  end interface
#endif
Andreas Marek's avatar
Andreas Marek committed
269
#endif /* not used anywhere */
270

271
  interface
Andreas Marek's avatar
Andreas Marek committed
272
273
    subroutine launch_compute_hh_trafo_c_kernel_real_double(q, hh, hh_dot, hh_tau, nev, nb, ldq, off, ncols) &
               bind(c,name="launch_compute_hh_trafo_c_kernel_real_double")
274

275
      use iso_c_binding
276

277
278
      implicit none
      integer(kind=c_int), value     :: nev, nb, ldq, off, ncols
279
280
281
      integer(kind=c_intptr_t), value  :: q
      integer(kind=c_intptr_t), value  :: hh_dot
      integer(c_intptr_t), value       :: hh_tau ,hh
282
283
    end subroutine
  end interface
284

285
#ifdef WANT_SINGLE_PRECISION_REAL
286
  interface
Andreas Marek's avatar
Andreas Marek committed
287
288
    subroutine launch_compute_hh_trafo_c_kernel_real_single(q, hh, hh_dot, hh_tau, nev, nb, ldq, off, ncols) &
               bind(c,name="launch_compute_hh_trafo_c_kernel_real_single")
289
290
291
292
293

      use iso_c_binding

      implicit none
      integer(kind=c_int), value     :: nev, nb, ldq, off, ncols
294
295
296
      integer(kind=c_intptr_t), value  :: q
      integer(kind=c_intptr_t), value  :: hh_dot
      integer(c_intptr_t), value       :: hh_tau ,hh
297
298
299
300
301
302
    end subroutine
  end interface

#endif

  interface
Andreas Marek's avatar
Andreas Marek committed
303
    subroutine launch_compute_hh_trafo_c_kernel_complex_double(q, hh, hh_tau, nev, nb,ldq,off, ncols) &
304
305
306
307
308
309
               bind(c,name="launch_compute_hh_trafo_c_kernel_complex_double")

      use iso_c_binding

      implicit none
      integer(kind=c_int), value    :: nev, nb, ldq, off, ncols
310
311
      integer(kind=c_intptr_t), value :: q
      integer(kind=c_intptr_t), value :: hh_tau ,hh
312
313
314
315
316
317
    end subroutine
  end interface

#ifdef WANT_SINGLE_PRECISION_COMPLEX

  interface
Andreas Marek's avatar
Andreas Marek committed
318
    subroutine launch_compute_hh_trafo_c_kernel_complex_single(q, hh, hh_tau, nev, nb,ldq,off, ncols) &
319
               bind(c,name="launch_compute_hh_trafo_c_kernel_complex_single")
320

321
      use iso_c_binding
322

323
324
      implicit none
      integer(kind=c_int), value    :: nev, nb, ldq, off, ncols
325
326
      integer(kind=c_intptr_t), value :: q
      integer(kind=c_intptr_t), value :: hh_tau ,hh
327
328
    end subroutine
  end interface
329
330
331

#endif

332
333
#if 0
  interface
Andreas Marek's avatar
Andreas Marek committed
334
    subroutine launch_compute_hh_trafo_c_kernel_complex_1_double(q, hh, hh_dot, hh_tau, nev, nb, ldq, off, ncols) &
335
336
337
338
339
340
                bind(c,name="launch_compute_hh_trafo_c_kernel_complex_1_double")

      use iso_c_binding

      implicit none
      integer(kind=c_int), value    :: nev, nb, ldq, off, ncols
341
342
      integer(kind=c_intptr_t), value :: q
      integer(kind=c_intptr_t), value :: hh_tau ,hh, hh_dot
343
344
345
346
347
348

    end subroutine
  end interface

#ifdef WANT_SINGLE_PRECISION_COMPLEX
  interface
Andreas Marek's avatar
Andreas Marek committed
349
    subroutine launch_compute_hh_trafo_c_kernel_complex_1_single(q, hh, hh_dot, hh_tau, nev, nb, ldq, off, ncols) &
350
                bind(c,name="launch_compute_hh_trafo_c_kernel_complex_1_single")
351

352
      use iso_c_binding
353

354
355
      implicit none
      integer(kind=c_int), value    :: nev, nb, ldq, off, ncols
356
357
      integer(kind=c_intptr_t), value :: q
      integer(kind=c_intptr_t), value :: hh_tau ,hh, hh_dot
358

359
360
    end subroutine
  end interface
361
362
363

#endif

364
365
366
#endif

  interface
Andreas Marek's avatar
Andreas Marek committed
367
368
    subroutine launch_my_unpack_c_kernel_real_double(row_count, n_offset, max_idx,stripe_width, a_dim2, stripe_count, &
                                                l_nev,row_group_dev, a_dev) bind(c,name="launch_my_unpack_c_kernel_real_double")
369
370
371
372
373
374
375
376
377
378
379

      use iso_c_binding

      implicit none
      integer(kind=c_int), value       :: row_count
      integer(kind=c_int), value       :: n_offset, max_idx,stripe_width, a_dim2, stripe_count, l_nev
      integer(kind=c_intptr_t), value  :: a_dev, row_group_dev

    end subroutine
  end interface

380
#ifdef WANT_SINGLE_PRECISION_REAL
381
  interface
Andreas Marek's avatar
Andreas Marek committed
382
383
    subroutine launch_my_unpack_c_kernel_real_single(row_count, n_offset, max_idx,stripe_width, a_dim2, stripe_count, &
                                                l_nev,row_group_dev, a_dev) bind(c,name="launch_my_unpack_c_kernel_real_single")
384
385
386
387
388
389
390
391
392
393
394
395
396
397

      use iso_c_binding

      implicit none
      integer(kind=c_int), value       :: row_count
      integer(kind=c_int), value       :: n_offset, max_idx,stripe_width, a_dim2, stripe_count, l_nev
      integer(kind=c_intptr_t), value  :: a_dev, row_group_dev

    end subroutine
  end interface

#endif

  interface
Andreas Marek's avatar
Andreas Marek committed
398
    subroutine launch_my_pack_c_kernel_real_double(row_count, n_offset, max_idx,stripe_width, a_dim2, &
399
                                                     stripe_count, l_nev, a_dev, &
Andreas Marek's avatar
Andreas Marek committed
400
                                                     row_group_dev) bind(c,name="launch_my_pack_c_kernel_real_double")
401
402
403
404
405
406
407
408
409
410
411

      use iso_c_binding

      implicit none
      integer(kind=c_int), value      :: row_count, n_offset, max_idx, stripe_width, a_dim2, stripe_count, l_nev
      integer(kind=c_intptr_t), value :: a_dev
      integer(kind=c_intptr_t), value :: row_group_dev

    end subroutine
  end interface

412
#ifdef WANT_SINGLE_PRECISION_REAL
413
  interface
Andreas Marek's avatar
Andreas Marek committed
414
    subroutine launch_my_pack_c_kernel_real_single(row_count, n_offset, max_idx,stripe_width, a_dim2, stripe_count, &
415
                                                     l_nev, a_dev, &
Andreas Marek's avatar
Andreas Marek committed
416
                                              row_group_dev) bind(c,name="launch_my_pack_c_kernel_real_single")
417
418
419
420
421
422
423
424
425
426
427
428
429
430

      use iso_c_binding

      implicit none
      integer(kind=c_int), value      :: row_count, n_offset, max_idx, stripe_width, a_dim2, stripe_count, l_nev
      integer(kind=c_intptr_t), value :: a_dev
      integer(kind=c_intptr_t), value :: row_group_dev

    end subroutine
  end interface

#endif

  interface
Andreas Marek's avatar
Andreas Marek committed
431
432
    subroutine launch_compute_hh_dotp_c_kernel_real_double(bcast_buffer_dev, hh_dot_dev, nbw, n) &
               bind(c,name="launch_compute_hh_dotp_c_kernel_real_double")
433
434
435
436
437
438
439
440
441
442
443
444
445

      use iso_c_binding

      implicit none
      integer(kind=c_intptr_t), value :: bcast_buffer_dev
      integer(kind=c_intptr_t), value :: hh_dot_dev
      integer(kind=c_int), value      :: nbw, n

    end subroutine
  end interface

#ifdef WANT_SINGLE_PRECISION_REAL
  interface
Andreas Marek's avatar
Andreas Marek committed
446
447
    subroutine launch_compute_hh_dotp_c_kernel_real_single(bcast_buffer_dev, hh_dot_dev, nbw, n) &
               bind(c,name="launch_compute_hh_dotp_c_kernel_real_single")
448
449
450
451
452
453
454
455
456
457
458

      use iso_c_binding

      implicit none
      integer(kind=c_intptr_t), value :: bcast_buffer_dev
      integer(kind=c_intptr_t), value :: hh_dot_dev
      integer(kind=c_int), value      :: nbw, n

    end subroutine
  end interface

459
460
461
#endif

  interface
Andreas Marek's avatar
Andreas Marek committed
462
463
    subroutine launch_extract_hh_tau_c_kernel_real_double(hh, hh_tau, nb, n, is_zero) &
               bind(c,NAME="launch_extract_hh_tau_c_kernel_real_double")
464
465
466
467

      use iso_c_binding

      implicit none
468
469
      integer(kind=c_intptr_t), value :: hh
      integer(kind=c_intptr_t), value :: hh_tau
470
471
472
473
474
475
      integer(kind=c_int), value    :: nb, n
      integer(kind=c_int), value    :: is_zero

    end subroutine
  end interface
#ifdef WANT_SINGLE_PRECISION_REAL
476
  interface
Andreas Marek's avatar
Andreas Marek committed
477
478
    subroutine launch_extract_hh_tau_c_kernel_real_single(hh, hh_tau, nb, n, is_zero) &
               bind(c,NAME="launch_extract_hh_tau_c_kernel_real_single")
479
480
481
482

      use iso_c_binding

      implicit none
483
484
      integer(kind=c_intptr_t), value :: hh
      integer(kind=c_intptr_t), value :: hh_tau
485
486
487
488
489
      integer(kind=c_int), value    :: nb, n
      integer(kind=c_int), value    :: is_zero

    end subroutine
  end interface
490
#endif
491
492

  interface
Andreas Marek's avatar
Andreas Marek committed
493
    subroutine launch_my_unpack_c_kernel_complex_double(row_count, n_offset, max_idx, stripe_width, a_dim2, &
494
495
                                                          stripe_count, l_nev, &
                                                 row_group_dev, a_dev) bind(c,name="launch_my_unpack_c_kernel_complex_double")
496
497
498
499
500
501
502
503

      use iso_c_binding

      implicit none

      integer(kind=c_int), value       :: row_count
      integer(kind=c_int), value       :: n_offset, max_idx,stripe_width, a_dim2, stripe_count,l_nev
      integer(kind=c_intptr_t), value  :: a_dev, row_group_dev
504

505
506
507
    end subroutine
  end interface

508
509
#ifdef WANT_SINGLE_PRECISION_COMPLEX
 interface
Andreas Marek's avatar
Andreas Marek committed
510
    subroutine launch_my_unpack_c_kernel_complex_single(row_count, n_offset, max_idx, stripe_width, a_dim2, stripe_count, l_nev, &
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
                                                 row_group_dev, a_dev) bind(c,name="launch_my_unpack_c_kernel_complex_single")

      use iso_c_binding

      implicit none

      integer(kind=c_int), value       :: row_count
      integer(kind=c_int), value       :: n_offset, max_idx,stripe_width, a_dim2, stripe_count,l_nev
      integer(kind=c_intptr_t), value  :: a_dev, row_group_dev

    end subroutine
  end interface

#endif

526
  interface
Andreas Marek's avatar
Andreas Marek committed
527
    subroutine launch_my_pack_c_kernel_complex_double(row_count, n_offset, max_idx,stripe_width,a_dim2, &
528
529
                                                        stripe_count, l_nev, a_dev, &
                                               row_group_dev) bind(c,name="launch_my_pack_c_kernel_complex_double")
530
531
532
533
534
535
536
537
538
539
540

      use iso_c_binding

      implicit none
      integer(kind=c_int), value      :: row_count, n_offset, max_idx, stripe_width, a_dim2,stripe_count, l_nev
      integer(kind=c_intptr_t), value :: a_dev
      integer(kind=c_intptr_t), value :: row_group_dev

    end subroutine
  end interface

541
#ifdef WANT_SINGLE_PRECISION_COMPLEX
542
  interface
Andreas Marek's avatar
Andreas Marek committed
543
    subroutine launch_my_pack_c_kernel_complex_single(row_count, n_offset, max_idx,stripe_width,a_dim2, &
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
                                                        stripe_count, l_nev, a_dev, &
                                               row_group_dev) bind(c,name="launch_my_pack_c_kernel_complex_single")

      use iso_c_binding

      implicit none
      integer(kind=c_int), value      :: row_count, n_offset, max_idx, stripe_width, a_dim2,stripe_count, l_nev
      integer(kind=c_intptr_t), value :: a_dev
      integer(kind=c_intptr_t), value :: row_group_dev

    end subroutine
  end interface

#endif

  interface
Andreas Marek's avatar
Andreas Marek committed
560
   subroutine launch_compute_hh_dotp_c_kernel_complex_double(bcast_buffer_dev, hh_dot_dev, nbw,n) &
561
562
563
564
565
566
567
568
569
570
571
572
573
              bind(c,name="launch_compute_hh_dotp_c_kernel_complex_double")

     use iso_c_binding

     implicit none
     integer(kind=c_intptr_t), value :: bcast_buffer_dev
     integer(kind=c_intptr_t), value :: hh_dot_dev
     integer(kind=c_int), value      :: nbw, n
   end subroutine
  end interface

#ifdef WANT_SINGLE_PRECISION_COMPLEX
  interface
Andreas Marek's avatar
Andreas Marek committed
574
   subroutine launch_compute_hh_dotp_c_kernel_complex_single(bcast_buffer_dev, hh_dot_dev, nbw,n) &
575
              bind(c,name="launch_compute_hh_dotp_c_kernel_complex_single")
576
577
578
579

     use iso_c_binding

     implicit none
580
581
582
     integer(kind=c_intptr_t), value :: bcast_buffer_dev
     integer(kind=c_intptr_t), value :: hh_dot_dev
     integer(kind=c_int), value      :: nbw, n
583
   end subroutine
584
  end interface
585

586
587
588
#endif

  interface
Andreas Marek's avatar
Andreas Marek committed
589
    subroutine launch_extract_hh_tau_c_kernel_complex_double(hh, hh_tau, nb, n, is_zero) &
590
591
592
593
594
               bind(c,name="launch_extract_hh_tau_c_kernel_complex_double")

      use iso_c_binding

      implicit none
595
596
      integer(kind=c_intptr_t), value :: hh
      integer(kind=c_intptr_t), value :: hh_tau
597
598
599
600
601
602
603
604
      integer(kind=c_int), value    :: nb, n
      integer(kind=c_int), value    :: is_zero

    end subroutine
  end interface

#ifdef WANT_SINGLE_PRECISION_COMPLEX

605
  interface
Andreas Marek's avatar
Andreas Marek committed
606
    subroutine launch_extract_hh_tau_c_kernel_complex_single(hh, hh_tau, nb, n, is_zero) &
607
               bind(c,name="launch_extract_hh_tau_c_kernel_complex_single")
608

609
      use iso_c_binding
610

611
      implicit none
612
613
      integer(kind=c_intptr_t), value :: hh
      integer(kind=c_intptr_t), value :: hh_tau
614
615
      integer(kind=c_int), value    :: nb, n
      integer(kind=c_int), value    :: is_zero
616

617
618
    end subroutine
  end interface
619

620
621
#endif

622
  contains
623

Andreas Marek's avatar
Andreas Marek committed
624
625
#if 0 /* not used anywhere */
    subroutine launch_dot_product_kernel_complex_double(hs_dev, hv_new_dev, tau_new, x_dev, h_dev,hv_dev, nr)
626
627
628
629
630
631
632
633

      use iso_c_binding
      use precision
      implicit none
      integer(kind=c_int)      :: nr
      integer(kind=C_intptr_T) :: hs_dev ,hv_new_dev,x_dev,h_dev, hv_dev
      complex(kind=ck8)         :: tau_new
#ifdef WITH_GPU_VERSION
Andreas Marek's avatar
Andreas Marek committed
634
      call launch_dot_product_kernel_c_complex_double(hs_dev, hv_new_dev, tau_new, x_dev, h_dev,hv_dev, nr)
635
636
637
638
#endif
    end subroutine

#ifdef WANT_SINGLE_PRECISION_COMPLEX
Andreas Marek's avatar
Andreas Marek committed
639
    subroutine launch_dot_product_kernel_complex_single(hs_dev, hv_new_dev, tau_new, x_dev, h_dev,hv_dev, nr)
640

641
      use iso_c_binding
642
      use precision
643
644
645
      implicit none
      integer(kind=c_int)      :: nr
      integer(kind=C_intptr_T) :: hs_dev ,hv_new_dev,x_dev,h_dev, hv_dev
646
      complex(kind=ck4)         :: tau_new
647
#ifdef WITH_GPU_VERSION
Andreas Marek's avatar
Andreas Marek committed
648
      call launch_dot_product_kernel_c_complex_single(hs_dev, hv_new_dev, tau_new, x_dev, h_dev,hv_dev, nr)
649
650
#endif
    end subroutine
651
#endif
652

Andreas Marek's avatar
Andreas Marek committed
653
654
655
656
657
#endif /* not used anywhere */

#if 0 /* not used anywhere */

    subroutine launch_dot_product_kernel_1_complex_double(ab_dev, hs_dev, hv_new_dev, x_dev,h_dev,hv_dev,nb, nr, ns)
658

659
      use iso_c_binding
660

661
662
663
664
      implicit none
      integer(kind=c_int)      ::  nb, nr, ns
      integer(kind=C_intptr_T) :: x_dev,h_dev, hv_dev, ab_dev, hs_dev,hv_new_dev
#ifdef WITH_GPU_VERSION
Andreas Marek's avatar
Andreas Marek committed
665
      call launch_dot_product_kernel_1_c_complex_double(ab_dev, hs_dev, hv_new_dev, x_dev,h_dev,hv_dev,nb, nr, ns)
666
667
#endif
    end subroutine
668

669
#ifdef WANT_SINGLE_PRECISION_COMPLEX
Andreas Marek's avatar
Andreas Marek committed
670
    subroutine launch_dot_product_kernel_1_complex_single(ab_dev, hs_dev, hv_new_dev, x_dev,h_dev,hv_dev,nb, nr, ns)
671
672
673
674
675
676
677

      use iso_c_binding

      implicit none
      integer(kind=c_int)      ::  nb, nr, ns
      integer(kind=C_intptr_T) :: x_dev,h_dev, hv_dev, ab_dev, hs_dev,hv_new_dev
#ifdef WITH_GPU_VERSION
Andreas Marek's avatar
Andreas Marek committed
678
      call launch_dot_product_kernel_1_c_complex_single(ab_dev, hs_dev, hv_new_dev, x_dev,h_dev,hv_dev,nb, nr, ns)
679
680
681
682
683
#endif
    end subroutine

#endif

Andreas Marek's avatar
Andreas Marek committed
684
685
686
687
#endif /* not used anywhere */

#if 0 /* not used anywhere */
    subroutine launch_dot_product_kernel_2_complex_double(ab_dev, hs_dev, hv_dev,hd_dev,nb, nr, ne)
688

689
      use iso_c_binding
690

691
692
693
694
      implicit none
      integer(kind=c_int)      ::  nb, nr, ne
      integer(kind=C_intptr_T) :: hd_dev,hv_dev, hs_dev, ab_dev
#ifdef WITH_GPU_VERSION
Andreas Marek's avatar
Andreas Marek committed
695
      call launch_dot_product_kernel_2_c_complex_double(ab_dev, hs_dev, hv_dev,hd_dev,nb, nr, ne)
696
697
#endif
    end subroutine
698

699
700
#ifdef WANT_SINGLE_PRECISION_COMPLEX

Andreas Marek's avatar
Andreas Marek committed
701
    subroutine launch_dot_product_kernel_2_complex_single(ab_dev, hs_dev, hv_dev,hd_dev,nb, nr, ne)
702
703
704
705
706
707
708

      use iso_c_binding

      implicit none
      integer(kind=c_int)      ::  nb, nr, ne
      integer(kind=C_intptr_T) :: hd_dev,hv_dev, hs_dev, ab_dev
#ifdef WITH_GPU_VERSION
Andreas Marek's avatar
Andreas Marek committed
709
      call launch_dot_product_kernel_2_c_complex_single(ab_dev, hs_dev, hv_dev,hd_dev,nb, nr, ne)
710
711
712
713
#endif
    end subroutine
#endif

Andreas Marek's avatar
Andreas Marek committed
714
715
716
717
#endif /* not used anywhere */

#if 0 /* not used anywhere */
    subroutine launch_double_hh_transform_1_complex_double(ab_dev, hs_dev,hv_dev,nb,ns)
718
719
720
721
722
723
724

      use iso_c_binding

      implicit none
      integer(kind=c_int)      ::  nb, ns
      integer(kind=C_intptr_T) :: hv_dev, ab_dev,hs_dev
#ifdef WITH_GPU_VERSION
Andreas Marek's avatar
Andreas Marek committed
725
      call launch_double_hh_transform_1_c_complex_double(ab_dev, hs_dev,hv_dev,nb,ns)
726
727
728
729
#endif
    end subroutine

#ifdef WANT_SINGLE_PRECISION_COMPLEX
Andreas Marek's avatar
Andreas Marek committed
730
    subroutine launch_double_hh_transform_1_complex_single(ab_dev, hs_dev,hv_dev,nb,ns)
731

732
      use iso_c_binding
733

734
735
736
737
      implicit none
      integer(kind=c_int)      ::  nb, ns
      integer(kind=C_intptr_T) :: hv_dev, ab_dev,hs_dev
#ifdef WITH_GPU_VERSION
Andreas Marek's avatar
Andreas Marek committed
738
      call launch_double_hh_transform_1_c_complex_single(ab_dev, hs_dev,hv_dev,nb,ns)
739
740
741
742
#endif
    end subroutine

#endif
Andreas Marek's avatar
Andreas Marek committed
743
#endif /*  not used anywhere */
744

Andreas Marek's avatar
Andreas Marek committed
745
746
#if 0 /* not used anywhere */
    subroutine launch_double_hh_transform_2_complex_double(ab_dev, hd_dev,hv_dev,nc,ns, nb)
747
748
749
750
751
752
753

      use iso_c_binding

      implicit none
      integer(kind=c_int)      ::  nc, ns, nb
      integer(kind=C_intptr_T) :: hv_dev, ab_dev,hd_dev
#ifdef WITH_GPU_VERSION
Andreas Marek's avatar
Andreas Marek committed
754
      call launch_double_hh_transform_2_c_complex_double(ab_dev, hd_dev,hv_dev,nc,ns, nb)
755
756
#endif
    end subroutine
757

758
759
#ifdef WANT_SINGLE_PRECISION_COMPLEX

Andreas Marek's avatar
Andreas Marek committed
760
    subroutine launch_double_hh_transform_2_complex_single(ab_dev, hd_dev,hv_dev,nc,ns, nb)
761

762
      use iso_c_binding
763

764
765
766
767
      implicit none
      integer(kind=c_int)      ::  nc, ns, nb
      integer(kind=C_intptr_T) :: hv_dev, ab_dev,hd_dev
#ifdef WITH_GPU_VERSION
Andreas Marek's avatar
Andreas Marek committed
768
      call launch_double_hh_transform_2_c_complex_single(ab_dev, hd_dev,hv_dev,nc,ns, nb)
769
770
771
772
#endif
    end subroutine

#endif
Andreas Marek's avatar
Andreas Marek committed
773
#endif /* not used anywhere */
774

Andreas Marek's avatar
Andreas Marek committed
775
776
#if 0 /* not used anywhere */
    subroutine launch_compute_kernel_reduce_complex_double(a_dev, lda, n, nbw, h1_dev)
777
778
779
780
781
782
783

      use iso_c_binding

      implicit none
      integer(kind=c_int)      :: n,lda,nbw
      integer(kind=C_intptr_T) :: h1_dev ,a_dev
#ifdef WITH_GPU_VERSION
Andreas Marek's avatar
Andreas Marek committed
784
      call launch_compute_kernel_reduce_c_complex_double(a_dev, lda, n, nbw, h1_dev)
785
786
#endif
    end subroutine
787

788
#ifdef WANT_SINGLE_PRECISION_COMPLEX
Andreas Marek's avatar
Andreas Marek committed
789
    subroutine launch_compute_kernel_reduce_complex_single(a_dev, lda, n, nbw, h1_dev)
790

791
      use iso_c_binding
792

793
794
795
796
      implicit none
      integer(kind=c_int)      :: n,lda,nbw
      integer(kind=C_intptr_T) :: h1_dev ,a_dev
#ifdef WITH_GPU_VERSION
Andreas Marek's avatar
Andreas Marek committed
797
      call launch_compute_kernel_reduce_c_complex_single(a_dev, lda, n, nbw, h1_dev)
798
799
#endif
    end subroutine
800

801
#endif
Andreas Marek's avatar
Andreas Marek committed
802
#endif /* not used anywhere */
803

Andreas Marek's avatar
Andreas Marek committed
804
805
806
#if 0 /* not used anywhere */

    subroutine launch_compute_kernel_reduce_1_complex_double(a_dev, lda, n, h1_dev)
807

808
      use iso_c_binding
809

810
811
812
813
      implicit none
      integer(kind=c_int)      :: n,lda
      integer(kind=C_intptr_T) :: h1_dev ,a_dev
#ifdef WITH_GPU_VERSION
Andreas Marek's avatar
Andreas Marek committed
814
      call launch_compute_kernel_reduce_1_c_complex_double(a_dev, lda, n, h1_dev)
815
816
#endif
    end subroutine
817

818
#ifdef WANT_SINGLE_PRECISION_COMPLEX
Andreas Marek's avatar
Andreas Marek committed
819
    subroutine launch_compute_kernel_reduce_1_complex_single(a_dev, lda, n, h1_dev)
820
821
822
823
824
825
826

      use iso_c_binding

      implicit none
      integer(kind=c_int)      :: n,lda
      integer(kind=C_intptr_T) :: h1_dev ,a_dev
#ifdef WITH_GPU_VERSION
Andreas Marek's avatar
Andreas Marek committed
827
      call launch_compute_kernel_reduce_1_c_complex_single(a_dev, lda, n, h1_dev)
828
829
830
831
#endif
    end subroutine

#endif
Andreas Marek's avatar
Andreas Marek committed
832
#endif /* not used anywhere */
833

Andreas Marek's avatar
Andreas Marek committed
834
    subroutine launch_compute_hh_trafo_gpu_kernel_real_double(q, hh, hh_dot, hh_tau, nev, nb, ldq, off, ncols)
835

836
      use iso_c_binding
837

838
839
      implicit none
      integer(kind=c_int)     :: nev, nb, ldq, off, ncols
840
841
842
      integer(kind=c_intptr_t)  :: q
      integer(kind=c_intptr_t)  :: hh_dot
      integer(c_intptr_t)       :: hh_tau ,hh
843
#ifdef WITH_GPU_VERSION
Andreas Marek's avatar
Andreas Marek committed
844
      call launch_compute_hh_trafo_c_kernel_real_double(q, hh, hh_dot, hh_tau, nev, nb, ldq, off, ncols)
845
846
#endif
    end subroutine
847

848
#ifdef WANT_SINGLE_PRECISION_REAL
Andreas Marek's avatar
Andreas Marek committed
849
    subroutine launch_compute_hh_trafo_gpu_kernel_real_single(q, hh, hh_dot, hh_tau, nev, nb, ldq, off, ncols)
850
851
852
853
854

      use iso_c_binding

      implicit none
      integer(kind=c_int)     :: nev, nb, ldq, off, ncols
855
856
857
      integer(kind=c_intptr_t)  :: q
      integer(kind=c_intptr_t)  :: hh_dot
      integer(c_intptr_t)       :: hh_tau ,hh
858
#ifdef WITH_GPU_VERSION
Andreas Marek's avatar
Andreas Marek committed
859
      call launch_compute_hh_trafo_c_kernel_real_single(q, hh, hh_dot, hh_tau, nev, nb, ldq, off, ncols)
860
861
862
863
864
#endif
    end subroutine

#endif

Andreas Marek's avatar
Andreas Marek committed
865
    subroutine launch_compute_hh_trafo_gpu_kernel_complex_double(q, hh, hh_tau, nev, nb,ldq,off, ncols)
866
867
868
869
870

      use iso_c_binding

      implicit none
      integer(kind=c_int)    :: nev, nb, ldq, off, ncols
871
872
      integer(kind=c_intptr_t) :: q
      integer(kind=c_intptr_t) :: hh_tau ,hh
873
#ifdef WITH_GPU_VERSION
Andreas Marek's avatar
Andreas Marek committed
874
      call launch_compute_hh_trafo_c_kernel_complex_double(q, hh, hh_tau, nev, nb,ldq,off, ncols)
875
876
877
878
#endif
    end subroutine

#ifdef WANT_SINGLE_PRECISION_COMPLEX
Andreas Marek's avatar
Andreas Marek committed
879
    subroutine launch_compute_hh_trafo_gpu_kernel_complex_single(q, hh, hh_tau, nev, nb,ldq,off, ncols)
880

881
      use iso_c_binding
882

883
884
      implicit none
      integer(kind=c_int)    :: nev, nb, ldq, off, ncols
885
886
      integer(kind=c_intptr_t) :: q
      integer(kind=c_intptr_t) :: hh_tau ,hh
887
#ifdef WITH_GPU_VERSION
Andreas Marek's avatar
Andreas Marek committed
888
      call launch_compute_hh_trafo_c_kernel_complex_single(q, hh, hh_tau, nev, nb,ldq,off, ncols)
889
890
#endif
    end subroutine
891

892
893
#endif

894
#if 0
Andreas Marek's avatar
Andreas Marek committed
895
    subroutine launch_compute_hh_trafo_gpu_kernel_1_complex_double(q, hh, hh_dot, hh_tau, nev, nb, ldq, off, ncols)
896
897
898
899
900

      use iso_c_binding

      implicit none
      integer(kind=c_int)    :: nev, nb, ldq, off, ncols
901
902
      integer(kind=c_intptr_t) :: q
      integer(kind=c_intptr_t) :: hh_tau ,hh, hh_dot
903
#ifdef WITH_GPU_VERSION
Andreas Marek's avatar
Andreas Marek committed
904
      call launch_compute_hh_trafo_c_kernel_complex_1_double(q, hh, hh_dot, hh_tau, nev, nb, ldq, off, ncols)
905
906
907
908
#endif
    end subroutine

#ifdef WANT_SINGLE_PRECISION_COMPLEX
Andreas Marek's avatar
Andreas Marek committed
909
    subroutine launch_compute_hh_trafo_gpu_kernel_1_complex_single(q, hh, hh_dot, hh_tau, nev, nb, ldq, off, ncols)
910

911
      use iso_c_binding
912

913
914
      implicit none
      integer(kind=c_int)    :: nev, nb, ldq, off, ncols
915
916
      integer(kind=c_intptr_t) :: q
      integer(kind=c_intptr_t) :: hh_tau ,hh, hh_dot
917
#ifdef WITH_GPU_VERSION
Andreas Marek's avatar
Andreas Marek committed
918
      call launch_compute_hh_trafo_c_kernel_complex_1_single(q, hh, hh_dot, hh_tau, nev, nb, ldq, off, ncols)
919
920
921
#endif
    end subroutine
#endif
922

923
924
#endif

Andreas Marek's avatar
Andreas Marek committed
925
    subroutine launch_my_unpack_gpu_kernel_real_double(row_count, n_offset, max_idx,stripe_width, a_dim2, stripe_count, &
926
                                              l_nev,row_group_dev, a_dev)
927

928
      use iso_c_binding
929

930
931
932
933
934
      implicit none
      integer(kind=c_int)       :: row_count
      integer(kind=c_int)       :: n_offset, max_idx,stripe_width, a_dim2, stripe_count, l_nev
      integer(kind=c_intptr_t)  :: a_dev, row_group_dev
#ifdef WITH_GPU_VERSION
Andreas Marek's avatar
Andreas Marek committed
935
      call launch_my_unpack_c_kernel_real_double(row_count, n_offset, max_idx,stripe_width, a_dim2, stripe_count, &
936
937
938
939
940
                                            l_nev,row_group_dev, a_dev)
#endif

    end subroutine

941
#ifdef WANT_SINGLE_PRECISION_REAL
Andreas Marek's avatar
Andreas Marek committed
942
    subroutine launch_my_unpack_gpu_kernel_real_single(row_count, n_offset, max_idx,stripe_width, a_dim2, stripe_count, &
943
944
945
946
947
948
949
950
951
                                              l_nev,row_group_dev, a_dev)

      use iso_c_binding

      implicit none
      integer(kind=c_int)       :: row_count
      integer(kind=c_int)       :: n_offset, max_idx,stripe_width, a_dim2, stripe_count, l_nev
      integer(kind=c_intptr_t)  :: a_dev, row_group_dev
#ifdef WITH_GPU_VERSION
Andreas Marek's avatar
Andreas Marek committed
952
      call launch_my_unpack_c_kernel_real_single(row_count, n_offset, max_idx,stripe_width, a_dim2, stripe_count, &
953
954
955
956
957
958
959
                                            l_nev,row_group_dev, a_dev)
#endif

    end subroutine

#endif

Andreas Marek's avatar
Andreas Marek committed
960
961
    subroutine launch_my_pack_gpu_kernel_real_double(row_count, n_offset, max_idx,stripe_width, a_dim2, &
                                                     stripe_count, l_nev, a_dev,  row_group_dev)
962
963
964
965
966
967
968
969

      use iso_c_binding