Skip to content

Commit bde0665

Browse files
committed
remove Fortran support for this patch
1 parent 1c46492 commit bde0665

File tree

6 files changed

+32
-139
lines changed

6 files changed

+32
-139
lines changed

openmp/runtime/src/include/omp_lib.F90.var

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -215,8 +215,6 @@
215215

216216
integer (kind=omp_interop_kind), parameter, public :: omp_interop_none = 0
217217

218-
integer (kind=omp_integer_kind), parameter, public :: omp_invalid_device = -2
219-
220218
interface
221219

222220
! ***
@@ -419,20 +417,6 @@
419417
integer (kind=omp_integer_kind) omp_get_device_num
420418
end function omp_get_device_num
421419

422-
function omp_get_uid_from_device(device_num) bind(c)
423-
use, intrinsic :: iso_c_binding, only: c_ptr
424-
use omp_lib_kinds
425-
integer (kind=omp_integer_kind), value :: device_num
426-
type(c_ptr) omp_get_uid_from_device
427-
end function omp_get_uid_from_device
428-
429-
function omp_get_device_from_uid(device_uid) bind(c)
430-
use, intrinsic :: iso_c_binding, only: c_ptr
431-
use omp_lib_kinds
432-
type(c_ptr), value :: device_uid
433-
integer (kind=omp_integer_kind) omp_get_device_from_uid
434-
end function omp_get_device_from_uid
435-
436420
function omp_pause_resource(kind, device_num) bind(c)
437421
use omp_lib_kinds
438422
integer (kind=omp_pause_resource_kind), value :: kind
@@ -1115,8 +1099,6 @@
11151099
public :: omp_is_initial_device
11161100
public :: omp_get_initial_device
11171101
public :: omp_get_device_num
1118-
public :: omp_get_uid_from_device
1119-
public :: omp_get_device_from_uid
11201102
public :: omp_pause_resource
11211103
public :: omp_pause_resource_all
11221104
public :: omp_get_supported_active_levels

openmp/runtime/src/include/omp_lib.h.var

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -291,9 +291,6 @@
291291
integer(kind=omp_interop_kind)omp_interop_none
292292
parameter(omp_interop_none=0)
293293

294-
integer(kind=omp_integer_kind)omp_invalid_device
295-
parameter(omp_invalid_device=-2)
296-
297294
interface
298295

299296
! ***
@@ -489,20 +486,6 @@
489486
integer (kind=omp_integer_kind) omp_get_device_num
490487
end function omp_get_device_num
491488

492-
function omp_get_uid_from_device(device_num) bind(c)
493-
import
494-
use, intrinsic :: iso_c_binding, only : c_ptr
495-
integer (kind=omp_integer_kind), value :: device_num
496-
type(c_ptr) omp_get_uid_from_device
497-
end function omp_get_uid_from_device
498-
499-
function omp_get_device_from_uid(device_uid) bind(c)
500-
import
501-
use, intrinsic :: iso_c_binding, only : c_ptr
502-
type(c_ptr), value :: device_uid
503-
integer (kind=omp_integer_kind) omp_get_device_from_uid
504-
end function omp_get_device_from_uid
505-
506489
function omp_pause_resource(kind, device_num) bind(c)
507490
import
508491
integer (kind=omp_pause_resource_kind), value :: kind
@@ -1176,8 +1159,6 @@
11761159
!DIR$ ATTRIBUTES OFFLOAD:MIC :: omp_get_initial_device
11771160
!DIR$ ATTRIBUTES OFFLOAD:MIC :: omp_get_num_devices
11781161
!DIR$ ATTRIBUTES OFFLOAD:MIC :: omp_get_device_num
1179-
!DIR$ ATTRIBUTES OFFLOAD:MIC :: omp_get_uid_from_device
1180-
!DIR$ ATTRIBUTES OFFLOAD:MIC :: omp_get_device_from_uid
11811162
!DIR$ ATTRIBUTES OFFLOAD:MIC :: omp_pause_resource
11821163
!DIR$ ATTRIBUTES OFFLOAD:MIC :: omp_pause_resource_all
11831164
!DIR$ ATTRIBUTES OFFLOAD:MIC :: omp_get_supported_active_levels
@@ -1261,8 +1242,6 @@
12611242
!$omp declare target(omp_get_initial_device )
12621243
!$omp declare target(omp_get_num_devices )
12631244
!$omp declare target(omp_get_device_num )
1264-
!$omp declare target(omp_get_uid_from_device )
1265-
!$omp declare target(omp_get_device_from_uid )
12661245
!$omp declare target(omp_pause_resource )
12671246
!$omp declare target(omp_pause_resource_all )
12681247
!$omp declare target(omp_get_supported_active_levels )

openmp/runtime/src/kmp_ftn_cdecl.cpp

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,36 @@ char const __kmp_version_ftncdecl[] =
2929
#define FTN_STDCALL /* no stdcall */
3030
#include "kmp_ftn_os.h"
3131
#include "kmp_ftn_entry.h"
32+
33+
// FIXME: this is a hack to get the UID functions working for C.
34+
// It will be moved and also made available for Fortran in a follow-up patch.
35+
extern "C" {
36+
const char *FTN_STDCALL omp_get_uid_from_device(int device_num)
37+
KMP_WEAK_ATTRIBUTE_EXTERNAL;
38+
const char *FTN_STDCALL omp_get_uid_from_device(int device_num) {
39+
#if KMP_OS_DARWIN || KMP_OS_WASI || defined(KMP_STUB)
40+
return nullptr;
41+
#else
42+
const char *(*fptr)(int);
43+
if ((*(void **)(&fptr) = KMP_DLSYM_NEXT("omp_get_uid_from_device")))
44+
return (*fptr)(device_num);
45+
// Returns the same string as used by libomptarget
46+
return "HOST";
47+
#endif
48+
}
49+
int FTN_STDCALL omp_get_device_from_uid(const char *device_uid)
50+
KMP_WEAK_ATTRIBUTE_EXTERNAL;
51+
int FTN_STDCALL omp_get_device_from_uid(const char *device_uid) {
52+
#if KMP_OS_DARWIN || KMP_OS_WASI || defined(KMP_STUB)
53+
return omp_invalid_device;
54+
#else
55+
int (*fptr)(const char *);
56+
if ((*(void **)(&fptr) = KMP_DLSYM_NEXT("omp_get_device_from_uid")))
57+
return (*fptr)(device_uid);
58+
return KMP_EXPAND_NAME(FTN_GET_INITIAL_DEVICE)();
59+
#endif
60+
}
61+
}
3262
#else
3363
"no";
3464
#endif /* KMP_FTN_ENTRIES */

openmp/runtime/src/kmp_ftn_entry.h

Lines changed: 2 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1543,38 +1543,13 @@ int FTN_STDCALL KMP_EXPAND_NAME(FTN_GET_MAX_TASK_PRIORITY)(void) {
15431543
#endif
15441544
}
15451545

1546-
// These functions will be defined in libomptarget. When libomptarget is not
1547-
// loaded, we assume we are on the host.
1546+
// This function will be defined in libomptarget. When libomptarget is not
1547+
// loaded, we assume we are on the host and return KMP_HOST_DEVICE.
15481548
// Compiler/libomptarget will handle this if called inside target.
15491549
int FTN_STDCALL FTN_GET_DEVICE_NUM(void) KMP_WEAK_ATTRIBUTE_EXTERNAL;
15501550
int FTN_STDCALL FTN_GET_DEVICE_NUM(void) {
15511551
return KMP_EXPAND_NAME(FTN_GET_INITIAL_DEVICE)();
15521552
}
1553-
const char *FTN_STDCALL FTN_GET_UID_FROM_DEVICE(int device_num)
1554-
KMP_WEAK_ATTRIBUTE_EXTERNAL;
1555-
const char *FTN_STDCALL FTN_GET_UID_FROM_DEVICE(int device_num) {
1556-
#if KMP_OS_DARWIN || KMP_OS_WASI || defined(KMP_STUB)
1557-
return nullptr;
1558-
#else
1559-
const char *(*fptr)(int);
1560-
if ((*(void **)(&fptr) = KMP_DLSYM_NEXT("omp_get_uid_from_device")))
1561-
return (*fptr)(device_num);
1562-
// Returns the same string as used by libomptarget
1563-
return "HOST";
1564-
#endif
1565-
}
1566-
int FTN_STDCALL FTN_GET_DEVICE_FROM_UID(const char *device_uid)
1567-
KMP_WEAK_ATTRIBUTE_EXTERNAL;
1568-
int FTN_STDCALL FTN_GET_DEVICE_FROM_UID(const char *device_uid) {
1569-
#if KMP_OS_DARWIN || KMP_OS_WASI || defined(KMP_STUB)
1570-
return omp_invalid_device;
1571-
#else
1572-
int (*fptr)(const char *);
1573-
if ((*(void **)(&fptr) = KMP_DLSYM_NEXT("omp_get_device_from_uid")))
1574-
return (*fptr)(device_uid);
1575-
return KMP_EXPAND_NAME(FTN_GET_INITIAL_DEVICE)();
1576-
#endif
1577-
}
15781553

15791554
// Compiler will ensure that this is only called from host in sequential region
15801555
int FTN_STDCALL KMP_EXPAND_NAME(FTN_PAUSE_RESOURCE)(kmp_pause_status_t kind,

openmp/runtime/src/kmp_ftn_os.h

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -140,8 +140,6 @@
140140
#define FTN_GET_MEMSPACE_NUM_RESOURCES omp_get_memspace_num_resources
141141
#define FTN_GET_SUBMEMSPACE omp_get_submemspace
142142
#define FTN_GET_DEVICE_NUM omp_get_device_num
143-
#define FTN_GET_UID_FROM_DEVICE omp_get_uid_from_device
144-
#define FTN_GET_DEVICE_FROM_UID omp_get_device_from_uid
145143
#define FTN_SET_AFFINITY_FORMAT omp_set_affinity_format
146144
#define FTN_GET_AFFINITY_FORMAT omp_get_affinity_format
147145
#define FTN_DISPLAY_AFFINITY omp_display_affinity
@@ -291,8 +289,6 @@
291289
#define FTN_ALLOC omp_alloc_
292290
#define FTN_FREE omp_free_
293291
#define FTN_GET_DEVICE_NUM omp_get_device_num_
294-
#define FTN_GET_UID_FROM_DEVICE omp_get_uid_from_device_
295-
#define FTN_GET_DEVICE_FROM_UID omp_get_device_from_uid_
296292
#define FTN_SET_AFFINITY_FORMAT omp_set_affinity_format_
297293
#define FTN_GET_AFFINITY_FORMAT omp_get_affinity_format_
298294
#define FTN_DISPLAY_AFFINITY omp_display_affinity_
@@ -440,8 +436,6 @@
440436
#define FTN_GET_MEMSPACE_NUM_RESOURCES OMP_GET_MEMSPACE_NUM_RESOURCES
441437
#define FTN_GET_SUBMEMSPACE OMP_GET_SUBMEMSPACE
442438
#define FTN_GET_DEVICE_NUM OMP_GET_DEVICE_NUM
443-
#define FTN_GET_UID_FROM_DEVICE OMP_GET_UID_FROM_DEVICE
444-
#define FTN_GET_DEVICE_FROM_UID OMP_GET_DEVICE_FROM_UID
445439
#define FTN_SET_AFFINITY_FORMAT OMP_SET_AFFINITY_FORMAT
446440
#define FTN_GET_AFFINITY_FORMAT OMP_GET_AFFINITY_FORMAT
447441
#define FTN_DISPLAY_AFFINITY OMP_DISPLAY_AFFINITY
@@ -591,8 +585,6 @@
591585
#define FTN_ALLOC OMP_ALLOC_
592586
#define FTN_FREE OMP_FREE_
593587
#define FTN_GET_DEVICE_NUM OMP_GET_DEVICE_NUM_
594-
#define FTN_GET_UID_FROM_DEVICE OMP_GET_UID_FROM_DEVICE_
595-
#define FTN_GET_DEVICE_FROM_UID OMP_GET_DEVICE_FROM_UID_
596588
#define FTN_SET_AFFINITY_FORMAT OMP_SET_AFFINITY_FORMAT_
597589
#define FTN_GET_AFFINITY_FORMAT OMP_GET_AFFINITY_FORMAT_
598590
#define FTN_DISPLAY_AFFINITY OMP_DISPLAY_AFFINITY_

openmp/runtime/test/api/omp_device_uid.f90

Lines changed: 0 additions & 65 deletions
This file was deleted.

0 commit comments

Comments
 (0)