Skip to content
Snippets Groups Projects
Commit fee46cd1 authored by Aidan Chalk's avatar Aidan Chalk
Browse files

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
/*******************************************************************************
* 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 )
......
......@@ -33,4 +33,9 @@ struct res {
/* The resource's parent. */
int parent;
#ifdef WITH_CUDA
void* data, gpu_data;
int size;
#endif
};
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment