Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
elpa
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
11
Issues
11
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
Operations
Operations
Incidents
Environments
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
elpa
elpa
Commits
2abb70b1
Commit
2abb70b1
authored
Feb 14, 2017
by
Andreas Marek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add cudaThreadSynchronize Fortran wrapper
parent
2c4387dd
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
34 additions
and
1 deletion
+34
-1
src/cudaFunctions.cu
src/cudaFunctions.cu
+11
-0
src/mod_cuda.F90
src/mod_cuda.F90
+23
-1
No files found.
src/cudaFunctions.cu
View file @
2abb70b1
...
...
@@ -69,6 +69,17 @@
#ifdef WITH_GPU_VERSION
extern
"C"
{
int
cudaThreadSynchronizeFromC
()
{
cudaError_t
cuerr
=
cudaThreadSynchronize
();
if
(
cuerr
!=
cudaSuccess
)
{
errormessage
(
"Error in cudaThreadSynchronize: %s
\n
"
,
cudaGetErrorString
(
cuerr
));
return
0
;
}
return
1
;
}
int
cudaSetDeviceFromC
(
int
n
)
{
cudaError_t
cuerr
=
cudaSetDevice
(
n
);
...
...
src/mod_cuda.F90
View file @
2abb70b1
...
...
@@ -67,6 +67,15 @@ module cuda_functions
! functions to set and query the CUDA devices
interface
function
cuda_threadsynchronize_c
()
result
(
istat
)
&
bind
(
C
,
name
=
"cudaThreadSynchronizeFromC"
)
use
iso_c_binding
implicit
none
integer
(
kind
=
C_INT
)
::
istat
end
function
cuda_threadsynchronize_c
end
interface
interface
function
cuda_setdevice_c
(
n
)
result
(
istat
)
&
bind
(
C
,
name
=
"cudaSetDeviceFromC"
)
...
...
@@ -407,6 +416,19 @@ module cuda_functions
! functions to set and query the CUDA devices
function
cuda_threadsynchronize
()
result
(
success
)
use
iso_c_binding
implicit
none
logical
::
success
#ifdef WITH_GPU_VERSION
success
=
cuda_threadsynchronize_c
()
/
=
0
#else
success
=
.true.
#endif
end
function
cuda_threadsynchronize
function
cuda_setdevice
(
n
)
result
(
success
)
use
iso_c_binding
...
...
@@ -560,7 +582,6 @@ module cuda_functions
#endif
end
function
function
cuda_memcpy
(
dst
,
src
,
size
,
dir
)
result
(
success
)
use
iso_c_binding
...
...
@@ -571,6 +592,7 @@ module cuda_functions
integer
(
kind
=
C_SIZE_T
),
intent
(
in
)
::
size
integer
(
kind
=
C_INT
),
intent
(
in
)
::
dir
logical
::
success
#ifdef WITH_GPU_VERSION
success
=
cuda_memcpy_c
(
dst
,
src
,
size
,
dir
)
/
=
0
#else
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment