-
Notifications
You must be signed in to change notification settings - Fork 9
/
quof.f90
602 lines (547 loc) · 22.3 KB
/
quof.f90
1
2
3
4
5
6
7
8
9
10
11
12
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
!
! Copyright (c) 2013-2024 Triad National Security, LLC
! All rights reserved.
!
! This file is part of the libquo project. See the LICENSE file at the
! top-level directory of this distribution.
!
module quo
use, intrinsic :: iso_c_binding
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! return codes
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
integer(c_int) QUO_SUCCESS
integer(c_int) QUO_SUCCESS_ALREADY_DONE
integer(c_int) QUO_ERR
integer(c_int) QUO_ERR_SYS
integer(c_int) QUO_ERR_OOR
integer(c_int) QUO_ERR_INVLD_ARG
integer(c_int) QUO_ERR_CALL_BEFORE_INIT
integer(c_int) QUO_ERR_TOPO
integer(c_int) QUO_ERR_MPI
integer(c_int) QUO_ERR_NOT_SUPPORTED
integer(c_int) QUO_ERR_POP
integer(c_int) QUO_ERR_NOT_FOUND
parameter (QUO_SUCCESS = 0)
parameter (QUO_SUCCESS_ALREADY_DONE = 1)
parameter (QUO_ERR = 2)
parameter (QUO_ERR_SYS = 3)
parameter (QUO_ERR_OOR = 4)
parameter (QUO_ERR_INVLD_ARG = 5)
parameter (QUO_ERR_CALL_BEFORE_INIT = 6)
parameter (QUO_ERR_TOPO = 7)
parameter (QUO_ERR_MPI = 8)
parameter (QUO_ERR_NOT_SUPPORTED = 9)
parameter (QUO_ERR_POP = 10)
parameter (QUO_ERR_NOT_FOUND = 11)
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! quo object types
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
integer(c_int) QUO_OBJ_MACHINE
integer(c_int) QUO_OBJ_NUMANODE
integer(c_int) QUO_OBJ_PACKAGE
integer(c_int) QUO_OBJ_SOCKET
integer(c_int) QUO_OBJ_CORE
integer(c_int) QUO_OBJ_PU
parameter (QUO_OBJ_MACHINE = 0)
parameter (QUO_OBJ_NUMANODE = 1)
parameter (QUO_OBJ_PACKAGE = 2)
parameter (QUO_OBJ_SOCKET = 3)
parameter (QUO_OBJ_CORE = 4)
parameter (QUO_OBJ_PU = 5)
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! push policies
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
integer(c_int) QUO_BIND_PUSH_PROVIDED
integer(c_int) QUO_BIND_PUSH_OBJ
parameter (QUO_BIND_PUSH_PROVIDED = 0)
parameter (QUO_BIND_PUSH_OBJ = 1)
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! context create flags
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
integer(c_int) QUO_CREATE_NO_MT
parameter (QUO_CREATE_NO_MT = 1)
interface
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
integer(c_int) &
function quo_ptr_free_c(cptr) &
bind(c, name='QUO_ptr_free')
use, intrinsic :: iso_c_binding, only: c_ptr, c_int
implicit none
type(c_ptr), value :: cptr
end function quo_ptr_free_c
end interface
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
interface
integer(c_int) &
function quo_version_c(version, subversion) &
bind(c, name='QUO_version')
use, intrinsic :: iso_c_binding, only: c_int
implicit none
integer(c_int), intent(out) :: version, subversion
end function quo_version_c
end interface
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
interface
integer(c_int) &
function quo_create_c(q, comm) &
bind(c, name='QUO_create_f2c')
use, intrinsic :: iso_c_binding, only: c_ptr, c_int
implicit none
type(c_ptr), intent(out) :: q
integer(c_int), value :: comm
end function quo_create_c
end interface
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
interface
integer(c_int) &
function quo_create_with_flags_c(q, comm, flags) &
bind(c, name='QUO_create_with_flags_f2c')
use, intrinsic :: iso_c_binding, only: c_ptr, c_int
implicit none
type(c_ptr), intent(out) :: q
integer(c_int), value :: comm
integer(c_int), value :: flags
end function quo_create_with_flags_c
end interface
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
interface
integer(c_int) &
function quo_free_c(q) &
bind(c, name='QUO_free')
use, intrinsic :: iso_c_binding, only: c_ptr, c_int
implicit none
type(c_ptr), value :: q
end function quo_free_c
end interface
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
interface
integer(c_int) &
function quo_nobjs_by_type_c(q, target_type, out_nobjs) &
bind(c, name='QUO_nobjs_by_type')
use, intrinsic :: iso_c_binding, only: c_ptr, c_int
implicit none
type(c_ptr), value :: q
integer(c_int), value :: target_type
integer(c_int), intent(out) :: out_nobjs
end function quo_nobjs_by_type_c
end interface
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
interface
integer(c_int) &
function quo_nobjs_in_type_by_type_c(q, in_type, type_index, &
obj_type, oresult) &
bind(c, name='QUO_nobjs_in_type_by_type')
use, intrinsic :: iso_c_binding, only: c_ptr, c_int
implicit none
type(c_ptr), value :: q
integer(c_int), value :: in_type, type_index, obj_type
integer(c_int), intent(out) :: oresult
end function quo_nobjs_in_type_by_type_c
end interface
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
interface
integer(c_int) &
function quo_cpuset_in_type_c(q, obj_type, type_index, oresult) &
bind(c, name='QUO_cpuset_in_type')
use, intrinsic :: iso_c_binding, only: c_ptr, c_int
implicit none
type(c_ptr), value :: q
integer(c_int), value :: obj_type, type_index
integer(c_int), intent(out) :: oresult
end function quo_cpuset_in_type_c
end interface
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
interface
integer(c_int) &
function quo_qids_in_type_c(q, obj_type, type_index, &
onqids, qids) &
bind(c, name='QUO_qids_in_type')
use, intrinsic :: iso_c_binding, only: c_int, c_ptr
implicit none
type(c_ptr), value :: q
integer(c_int), value :: obj_type, type_index
integer(c_int), intent(out) :: onqids
type(c_ptr), intent(out) :: qids
end function quo_qids_in_type_c
end interface
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
interface
integer(c_int) &
function quo_nnumanodes_c(q, n) &
bind(c, name='QUO_nnumanodes')
use, intrinsic :: iso_c_binding, only: c_ptr, c_int
implicit none
type(c_ptr), value :: q
integer(c_int), intent(out) :: n
end function quo_nnumanodes_c
end interface
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
interface
integer(c_int) &
function quo_nsockets_c(q, n) &
bind(c, name='QUO_nsockets')
use, intrinsic :: iso_c_binding, only: c_ptr, c_int
implicit none
type(c_ptr), value :: q
integer(c_int), intent(out) :: n
end function quo_nsockets_c
end interface
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
interface
integer(c_int) &
function quo_ncores_c(q, n) &
bind(c, name='QUO_ncores')
use, intrinsic :: iso_c_binding, only: c_ptr, c_int
implicit none
type(c_ptr), value :: q
integer(c_int), intent(out) :: n
end function quo_ncores_c
end interface
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
interface
integer(c_int) &
function quo_npus_c(q, n) &
bind(c, name='QUO_npus')
use, intrinsic :: iso_c_binding, only: c_ptr, c_int
implicit none
type(c_ptr), value :: q
integer(c_int), intent(out) :: n
end function quo_npus_c
end interface
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
interface
integer(c_int) &
function quo_nnodes_c(q, n) &
bind(c, name='QUO_nnodes')
use, intrinsic :: iso_c_binding, only: c_ptr, c_int
implicit none
type(c_ptr), value :: q
integer(c_int), intent(out) :: n
end function quo_nnodes_c
end interface
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
interface
integer(c_int) &
function quo_nqids_c(q, n) &
bind(c, name='QUO_nqids')
use, intrinsic :: iso_c_binding, only: c_ptr, c_int
implicit none
type(c_ptr), value :: q
integer(c_int), intent(out) :: n
end function quo_nqids_c
end interface
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
interface
integer(c_int) &
function quo_id_c(q, n) &
bind(c, name='QUO_id')
use, intrinsic :: iso_c_binding, only: c_ptr, c_int
implicit none
type(c_ptr), value :: q
integer(c_int), intent(out) :: n
end function quo_id_c
end interface
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
interface
integer(c_int) &
function quo_bound_c(q, bound) &
bind(c, name='QUO_bound')
use, intrinsic :: iso_c_binding, only: c_ptr, c_int
implicit none
type(c_ptr), value :: q
integer(c_int), intent (out) :: bound
end function quo_bound_c
end interface
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
interface
integer(c_int) &
function quo_bind_push_c(q, policy, obj_type, obj_index) &
bind(c, name='QUO_bind_push')
use, intrinsic :: iso_c_binding, only: c_ptr, c_int
implicit none
type(c_ptr), value :: q
integer(c_int), value :: policy, obj_type, obj_index
end function quo_bind_push_c
end interface
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
interface
integer(c_int) &
function quo_bind_pop_c(q) &
bind(c, name='QUO_bind_pop')
use, intrinsic :: iso_c_binding, only: c_ptr, c_int
implicit none
type(c_ptr), value :: q
end function quo_bind_pop_c
end interface
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
interface
integer(c_int) &
function quo_barrier_c(q) &
bind(c, name='QUO_barrier')
use, intrinsic :: iso_c_binding, only: c_ptr, c_int
implicit none
type(c_ptr), value :: q
end function quo_barrier_c
end interface
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
interface
integer(c_int) &
function quo_auto_distrib_c(q, distrib_over_this, &
max_qids_per_res_type, oselected) &
bind(c, name='QUO_auto_distrib')
use, intrinsic :: iso_c_binding, only: c_ptr, c_int
implicit none
type(c_ptr), value :: q
integer(c_int), value :: distrib_over_this
integer(c_int), value :: max_qids_per_res_type
integer(c_int), intent(out) :: oselected
end function quo_auto_distrib_c
end interface
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
interface
integer(c_int) &
function quo_get_mpi_comm_by_type_c(q, target_type, comm) &
bind(c, name='QUO_get_mpi_comm_by_type_f2c')
use, intrinsic :: iso_c_binding, only: c_ptr, c_int
implicit none
type(c_ptr), value :: q
integer(c_int), value :: target_type
integer(c_int), intent(out):: comm
end function quo_get_mpi_comm_by_type_c
end interface
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!interface
! integer(c_int) &
! function quo_bind_threads_c(q, type, index) &
! bind(c, name='QUO_bind_threads')
! use, intrinsic :: iso_c_binding, only: c_int
! import :: c_ptr
! implicit none
! type(c_ptr), value :: q
! integer(c_int), value :: type, index
! end function quo_bind_threads_c
!end interface
contains
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
subroutine quo_ptr_free(cptr)
use, intrinsic :: iso_c_binding, only: c_ptr, c_int
implicit none
type(c_ptr), value :: cptr
integer(c_int) :: ierr
ierr = quo_ptr_free_c(cptr)
end subroutine quo_ptr_free
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
subroutine quo_version(version, subversion, ierr)
use, intrinsic :: iso_c_binding, only: c_int
implicit none
integer(c_int), intent(out) :: version, subversion, ierr
ierr = quo_version_c(version, subversion)
end subroutine quo_version
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
subroutine quo_create(q, comm, ierr)
use, intrinsic :: iso_c_binding, only: c_ptr, c_int
implicit none
type(c_ptr), intent(out) :: q
integer, value :: comm
integer(c_int), intent(out) :: ierr
ierr = quo_create_c(q, comm)
end subroutine quo_create
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
subroutine quo_create_with_flags(q, comm, flags, ierr)
use, intrinsic :: iso_c_binding, only: c_ptr, c_int
implicit none
type(c_ptr), intent(out) :: q
integer, value :: comm
integer, value :: flags
integer(c_int), intent(out) :: ierr
ierr = quo_create_with_flags_c(q, comm, flags)
end subroutine quo_create_with_flags
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
subroutine quo_free(q, ierr)
use, intrinsic :: iso_c_binding, only: c_ptr, c_int
implicit none
type(c_ptr), value :: q
integer(c_int), intent(out) :: ierr
ierr = quo_free_c(q)
end subroutine quo_free
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
subroutine quo_nobjs_by_type(q, target_type, out_nobjs, ierr)
use, intrinsic :: iso_c_binding, only: c_ptr, c_int
implicit none
type(c_ptr), value :: q
integer(c_int), value :: target_type
integer(c_int), intent(out) :: out_nobjs
integer(c_int), intent(out) :: ierr
ierr = quo_nobjs_by_type_c(q, target_type, out_nobjs)
end subroutine quo_nobjs_by_type
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
subroutine quo_nobjs_in_type_by_type(q, in_type, type_index, &
obj_type, oresult, ierr)
use, intrinsic :: iso_c_binding, only: c_ptr, c_int
implicit none
type(c_ptr), value :: q
integer(c_int), value :: in_type, type_index, obj_type
integer(c_int), intent(out) :: oresult, ierr
ierr = quo_nobjs_in_type_by_type_c(q, in_type, type_index, &
obj_type, oresult)
end subroutine quo_nobjs_in_type_by_type
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
subroutine quo_cpuset_in_type(q, obj_type, type_index, &
oresult, ierr)
use, intrinsic :: iso_c_binding, only: c_ptr, c_int
implicit none
type(c_ptr), value :: q
integer(c_int), value :: obj_type, type_index
logical, intent (out) :: oresult
integer(c_int), intent(out) :: ierr
integer(c_int) :: ires
ierr = quo_cpuset_in_type_c(q, obj_type, type_index, ires)
oresult = (ires == 1)
end subroutine quo_cpuset_in_type
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
subroutine quo_qids_in_type(q, obj_type, type_index, qids, ierr)
use, intrinsic :: iso_c_binding, only: c_ptr, c_int
implicit none
type(c_ptr), value :: q
integer(c_int), value :: obj_type, type_index
integer(c_int), allocatable, intent(out) :: qids(:)
integer(c_int), pointer :: qidsp(:)
type(c_ptr) :: qidp
integer(c_int), intent(out) :: ierr
integer(c_int) :: nqids, i
ierr = quo_qids_in_type_c(q, obj_type, type_index, &
nqids, qidp)
call c_f_pointer(qidp, qidsp, [nqids])
allocate (qids(nqids))
forall (i = 1 : size(qidsp)) qids(i) = qidsp(i)
call quo_ptr_free(qidp)
end subroutine quo_qids_in_type
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
subroutine quo_nnumanodes(q, n, ierr)
use, intrinsic :: iso_c_binding, only: c_ptr, c_int
implicit none
type(c_ptr), value :: q
integer(c_int), intent(out) :: n, ierr
ierr = quo_nnumanodes_c(q, n)
end subroutine quo_nnumanodes
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
subroutine quo_nsockets(q, n, ierr)
use, intrinsic :: iso_c_binding, only: c_ptr, c_int
implicit none
type(c_ptr), value :: q
integer(c_int), intent(out) :: n, ierr
ierr = quo_nsockets_c(q, n)
end subroutine quo_nsockets
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
subroutine quo_ncores(q, n, ierr)
use, intrinsic :: iso_c_binding, only: c_ptr, c_int
implicit none
type(c_ptr), value :: q
integer(c_int), intent(out) :: n, ierr
ierr = quo_ncores_c(q, n)
end subroutine quo_ncores
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
subroutine quo_npus(q, n, ierr)
use, intrinsic :: iso_c_binding, only: c_ptr, c_int
implicit none
type(c_ptr), value :: q
integer(c_int), intent(out) :: n, ierr
ierr = quo_npus_c(q, n)
end subroutine quo_npus
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
subroutine quo_nnodes(q, n, ierr)
use, intrinsic :: iso_c_binding, only: c_ptr, c_int
implicit none
type(c_ptr), value :: q
integer(c_int), intent(out) :: n, ierr
ierr = quo_nnodes_c(q, n)
end subroutine quo_nnodes
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
subroutine quo_nqids(q, n, ierr)
use, intrinsic :: iso_c_binding, only: c_ptr, c_int
implicit none
type(c_ptr), value :: q
integer(c_int), intent(out) :: n, ierr
ierr = quo_nqids_c(q, n)
end subroutine quo_nqids
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
subroutine quo_id(q, n, ierr)
use, intrinsic :: iso_c_binding, only: c_ptr, c_int
implicit none
type(c_ptr), value :: q
integer(c_int), intent(out) :: n, ierr
ierr = quo_id_c(q, n)
end subroutine quo_id
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
subroutine quo_bound(q, bound, ierr)
use, intrinsic :: iso_c_binding, only: c_ptr, c_int
implicit none
type(c_ptr), value :: q
logical, intent (out) :: bound
integer(c_int), intent(out) :: ierr
integer(c_int) :: ibound = 0
ierr = quo_bound_c(q, ibound)
bound = (ibound == 1)
end subroutine quo_bound
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
subroutine quo_bind_push(q, policy, obj_type, obj_index, ierr)
use, intrinsic :: iso_c_binding, only: c_ptr, c_int
implicit none
type(c_ptr), value :: q
integer(c_int), value :: policy, obj_type, obj_index
integer(c_int), intent(out) :: ierr
ierr = quo_bind_push_c(q, policy, obj_type, obj_index)
end subroutine quo_bind_push
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
subroutine quo_bind_pop(q, ierr)
use, intrinsic :: iso_c_binding, only: c_ptr, c_int
implicit none
type(c_ptr), value :: q
integer(c_int), intent(out) :: ierr
ierr = quo_bind_pop_c(q)
end subroutine quo_bind_pop
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
subroutine quo_barrier(q, ierr)
use, intrinsic :: iso_c_binding, only: c_ptr, c_int
implicit none
type(c_ptr), value :: q
integer(c_int), intent(out) :: ierr
ierr = quo_barrier_c(q)
end subroutine quo_barrier
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
subroutine quo_auto_distrib(q, distrib_over_this, &
max_qids_per_res_type, oselected, &
ierr)
use, intrinsic :: iso_c_binding, only: c_ptr, c_int
implicit none
type(c_ptr), value :: q
integer(c_int), value :: distrib_over_this
integer(c_int), value :: max_qids_per_res_type
integer(c_int) :: iselected
logical, intent(out) :: oselected
integer(c_int), intent(out) :: ierr
ierr = quo_auto_distrib_c(q, distrib_over_this, &
max_qids_per_res_type, iselected)
oselected = (iselected == 1)
end subroutine quo_auto_distrib
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
subroutine quo_get_mpi_comm_by_type(q, target_type, comm, ierr)
use, intrinsic :: iso_c_binding, only: c_ptr, c_int
implicit none
type(c_ptr), value :: q
integer(c_int), value :: target_type
integer, intent(out) :: comm
integer(c_int), intent(out) :: ierr
ierr = quo_get_mpi_comm_by_type_c(q, target_type, comm)
end subroutine quo_get_mpi_comm_by_type
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!subroutine quo_bind_threads(q, type, index, ierr)
! use, intrinsic :: iso_c_binding, only: c_int
! implicit none
! type(c_ptr), value :: q
! integer(c_int), value :: type, index
! integer(c_int), intent(out) :: ierr
! ierr = quo_bind_threads_c(q, type, index)
!end subroutine quo_bind_threads
end module quo