Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Q
QuickSched
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
SWIFT
QuickSched
Commits
fee46cd1
Commit
fee46cd1
authored
11 years ago
by
Aidan Chalk
Browse files
Options
Downloads
Patches
Plain Diff
First addition of files to do the cuda queue. Makefiles and configure now compile with cuda
parent
9f79b247
No related branches found
No related tags found
Loading
Changes
22
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/lock.h
+24
-2
24 additions, 2 deletions
src/lock.h
src/res.h
+5
-0
5 additions, 0 deletions
src/res.h
with
29 additions
and
2 deletions
src/lock.h
+
24
−
2
View file @
fee46cd1
/*******************************************************************************
* This file is part of QuickSched.
* Coypright (c) 2013 Pedro Gonnet (pedro.gonnet@durham.ac.uk)
* Coypright (c) 2013 Pedro Gonnet (pedro.gonnet@durham.ac.uk)
, Aidan Chalk (aidan.chalk@durham.ac.uk)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published
...
...
@@ -26,7 +26,29 @@
# endif
#endif
#ifdef PTHREAD_LOCK
#ifdef WITH_CUDA
#undef INLINE
#endif
#ifdef WITH_CUDA
#define lock_type volatile int
#define lock_init( l ) ( *l = 0 )
#define lock_destroy( l ) 0
INLINE
static
int
lock_lock
(
volatile
int
*
l
)
{
while
(
atomicCAS
(
l
,
0
,
1
)
!=
0
);
return
0
;
}
INLINE
static
int
lock_trylock
(
volatile
int
*
l
)
{
int
res
=
atomicCAS
(
l
,
0
,
1
);
return
res
;
}
INLINE
static
int
lock_unlock
(
volatile
int
*
l
)
{
int
res
=
atomicCAS
(
l
,
1
,
0
)
!=
1
;
return
res
;
}
#define lock_unlock_blink( l ) atomicCAS( l , 1 , 0 )
#elif defined (PTHREAD_LOCK)
#define lock_type pthread_spinlock_t
#define lock_init( l ) ( pthread_spin_init( l , PTHREAD_PROCESS_PRIVATE ) != 0 )
#define lock_destroy( l ) ( pthread_spin_destroy( l ) != 0 )
...
...
This diff is collapsed.
Click to expand it.
src/res.h
+
5
−
0
View file @
fee46cd1
...
...
@@ -33,4 +33,9 @@ struct res {
/* The resource's parent. */
int
parent
;
#ifdef WITH_CUDA
void
*
data
,
gpu_data
;
int
size
;
#endif
};
This diff is collapsed.
Click to expand it.
Prev
1
2
Next
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment