COMPASS  5.0.0
End-to-end AO simulation tool using GPU acceleration
carma_multithread.h
Go to the documentation of this file.
1 // -----------------------------------------------------------------------------
2 // This file is part of COMPASS <https://anr-compass.github.io/compass/>
3 //
4 // Copyright (C) 2011-2019 COMPASS Team <https://github.com/ANR-COMPASS>
5 // All rights reserved.
6 // Distributed under GNU - LGPL
7 //
8 // COMPASS is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser
9 // General Public License as published by the Free Software Foundation, either version 3 of the License,
10 // or any later version.
11 //
12 // COMPASS: End-to-end AO simulation tool using GPU acceleration
13 // The COMPASS platform was designed to meet the need of high-performance for the simulation of AO systems.
14 //
15 // The final product includes a software package for simulating all the critical subcomponents of AO,
16 // particularly in the context of the ELT and a real-time core based on several control approaches,
17 // with performances consistent with its integration into an instrument. Taking advantage of the specific
18 // hardware architecture of the GPU, the COMPASS tool allows to achieve adequate execution speeds to
19 // conduct large simulation campaigns called to the ELT.
20 //
21 // The COMPASS platform can be used to carry a wide variety of simulations to both testspecific components
22 // of AO of the E-ELT (such as wavefront analysis device with a pyramid or elongated Laser star), and
23 // various systems configurations such as multi-conjugate AO.
24 //
25 // COMPASS is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the
26 // implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
27 // See the GNU Lesser General Public License for more details.
28 //
29 // You should have received a copy of the GNU Lesser General Public License along with COMPASS.
30 // If not, see <https://www.gnu.org/licenses/lgpl-3.0.txt>.
31 // -----------------------------------------------------------------------------
32 
40 
41 #ifndef CARMA_MULTITHREAD_H
42 #define CARMA_MULTITHREAD_H
43 
44 // Simple portable thread library.
45 
46 // POSIX threads.
47 #include <pthread.h>
48 
49 typedef pthread_t carma_thread;
50 typedef void *(*carma_routine)(void *);
51 
52 #define CARMAT_THREADPROC void *
53 #define CARMAT_THREADEND return 0
54 
56  pthread_mutex_t mutex;
57  pthread_cond_t conditionVariable;
59  int count;
60 };
61 
62 #ifdef __cplusplus
63 extern "C" {
64 #endif
65 
66 // Create thread
68 // Wait for thread to finish
70 // Destroy thread
72 // Wait for multiple threads
73 void carma_wait4thread(const carma_thread *threads, int num);
74 // Create barrier.
76 // Increment barrier. (excution continues)
78 // Wait for barrier release.
80 // Destory barrier
82 
83 #ifdef __cplusplus
84 } // extern "C"
85 #endif
86 
87 #endif // CARMA_MULTITHREAD_H
CarmaThreadBarrier::releaseCount
int releaseCount
Definition: carma_multithread.h:58
carma_destroy_barrier
void carma_destroy_barrier(CarmaThreadBarrier *barrier)
carma_create_barrier
CarmaThreadBarrier carma_create_barrier(int releaseCount)
carma_thread
pthread_t carma_thread
Definition: carma_multithread.h:49
CarmaThreadBarrier::conditionVariable
pthread_cond_t conditionVariable
Definition: carma_multithread.h:57
carma_increment_barrier
void carma_increment_barrier(CarmaThreadBarrier *barrier)
CarmaThreadBarrier
Definition: carma_multithread.h:55
carma_start_thread
carma_thread carma_start_thread(carma_routine func, void *data)
carma_wait4barrier
void carma_wait4barrier(CarmaThreadBarrier *barrier)
carma_destroy_thread
void carma_destroy_thread(carma_thread thread)
CarmaThreadBarrier::count
int count
Definition: carma_multithread.h:59
carma_end_thread
void carma_end_thread(carma_thread thread)
carma_wait4thread
void carma_wait4thread(const carma_thread *threads, int num)
CarmaThreadBarrier::mutex
pthread_mutex_t mutex
Definition: carma_multithread.h:56
carma_routine
void *(* carma_routine)(void *)
Definition: carma_multithread.h:50