forked from lgcrego/Dynemol
-
Notifications
You must be signed in to change notification settings - Fork 0
/
GPU.fi
51 lines (41 loc) · 2.22 KB
/
GPU.fi
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
#ifdef GPU_PIN_MEM
# warning "Allocate with pinned memory (fortran): on"
! # define GPU_ALLOC_1arg(A) NotUsed
! # define GPU_ALLOC_2arg(A,N) NotUsed
! # define GPU_ALLOC_3arg(A,N,M) GPU_Alloc_double( A, N, M )
! # define GPU_ALLOC_4arg(A,N,M,S) GPU_Alloc_double( A, N, M )
! # define GET_MACRO(1,2,3,4,FUNC, ...) FUNC
! # define GPU_Allocate(...) GET_MACRO( __VA_ARGS__, \
! GPU_ALLOC_4arg, \
! GPU_ALLOC_3arg, \
! GPU_ALLOC_2arg, \
! GPU_ALLOC_1arg \
! )(__VA_ARGS__)
# define GPU_Allocate(A,N,M) GPU_Alloc_double( A, N, M )
# define GPU_ALLOCATE(A,N,M,S) GPU_Alloc_double( A, N, M )
# define GPU_Deallocate( A ) GPU_Dealloc( A )
#else
# warning "Allocate with pinned memory (fortran): off"
! # define GPU_ALLOC_1arg(A) NotUsed
! # define GPU_ALLOC_2arg(A,N) NotUsed
! # define GPU_ALLOC_3arg(A,N,M) allocate( A(N,M) )
! # define GPU_ALLOC_4arg(A,N,M,S) allocate( A(N,M), S )
! # define GET_MACRO(1,2,3,4,FUNC, ...) FUNC
! # define GPU_Allocate(...) GET_MACRO( __VA_ARGS__, \
! GPU_ALLOC_4arg, \
! GPU_ALLOC_3arg, \
! GPU_ALLOC_2arg, \
! GPU_ALLOC_1arg \
! )(__VA_ARGS__)
# define GPU_Allocate(A,N,M) allocate( A(N,M) )
# define GPU_ALLOCATE(A,N,M,S) allocate( A(N,M), S )
# define GPU_Deallocate( A ) deallocate( A )
#endif
#ifdef GPU_SYGVD2S_VER
# warning "SYGVD calls GPU_dsygvd2s"
# define SYGVD( A , B , C , D , E , F , G ) GPU_dsygvd2s( D, E, F, size(A,2), A, size(A,1), B, size(B,1), C, G )
#else
# warning "SYGVD calls GPU_dsygvd"
# define SYGVD( A , B , C , D , E , F , G ) GPU_dsygvd( D, E, F, size(A,2), A, size(A,1), B, size(B,1), C, G )
#endif
#define DGEMM( A, B, C, D, E, F, G, H, I, J, K, L, M ) GPU_dgemm( A, B, C, D, E, F, G, H, I, J, K, L, M )