Scippy

SCIP

Solving Constraint Integer Programs

tpi.h
Go to the documentation of this file.
1/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
2/* */
3/* This file is part of the program and library */
4/* SCIP --- Solving Constraint Integer Programs */
5/* */
6/* Copyright (c) 2002-2024 Zuse Institute Berlin (ZIB) */
7/* */
8/* Licensed under the Apache License, Version 2.0 (the "License"); */
9/* you may not use this file except in compliance with the License. */
10/* You may obtain a copy of the License at */
11/* */
12/* http://www.apache.org/licenses/LICENSE-2.0 */
13/* */
14/* Unless required by applicable law or agreed to in writing, software */
15/* distributed under the License is distributed on an "AS IS" BASIS, */
16/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. */
17/* See the License for the specific language governing permissions and */
18/* limitations under the License. */
19/* */
20/* You should have received a copy of the Apache-2.0 license */
21/* along with SCIP; see the file LICENSE. If not visit scipopt.org. */
22/* */
23/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
24
25/**@file tpi.h
26 * @ingroup TASKINTERFACE
27 * @brief the type definitions for the SCIP parallel interface
28 * @author Leona Gottwald
29 * @author Stephen J. Maher
30 * @author Marc Pfetsch
31 */
32
33/*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
34
35#ifndef __TPI_H__
36#define __TPI_H__
37
38#include "scip/def.h"
39#include "scip/type_retcode.h"
40#include "tpi/type_tpi.h"
41
42/** creates and initializes the given lock */
43SCIP_EXPORT
45 SCIP_LOCK** lock /**< the lock */
46 );
47
48/** destroys and frees the given lock */
49SCIP_EXPORT
51 SCIP_LOCK** lock /**< the lock */
52 );
53
54/** acquires the given lock */
55SCIP_EXPORT
57 SCIP_LOCK* lock /**< the lock */
58 );
59
60/** releases the given lock */
61SCIP_EXPORT
63 SCIP_LOCK* lock /**< the lock */
64 );
65
66/** initializes the given condition variable */
67SCIP_EXPORT
69 SCIP_CONDITION** condition /**< condition to be created and initialized */
70 );
71
72/** destroys the given condition variable */
73SCIP_EXPORT
75 SCIP_CONDITION** condition /**< condition to be destroyed and freed */
76 );
77
78/** signals one waiting thread */
79SCIP_EXPORT
81 SCIP_CONDITION* condition /**< the condition variable to signal */
82 );
83
84/** signals all waiting threads */
85SCIP_EXPORT
87 SCIP_CONDITION* condition /**< the condition variable to broadcast */
88 );
89
90/** waits on a condition variable. The given lock must be held by the caller and will
91 * be held when this function returns.
92 */
93SCIP_EXPORT
95 SCIP_CONDITION* condition, /**< the condition variable to wait on */
96 SCIP_LOCK* lock /**< the lock that is held by the caller */
97 );
98
99/** returns the number of threads */
100SCIP_EXPORT
102 void
103 );
104
105/** returns the thread number */
106SCIP_EXPORT
108 void
109 );
110
111/** creates a job for parallel processing */
112SCIP_EXPORT
114 SCIP_JOB** job, /**< pointer to the job that will be created */
115 int jobid, /**< the id for the current job */
116 SCIP_RETCODE (*jobfunc)(void* args),/**< pointer to the job function */
117 void* jobarg /**< the job's argument */
118 );
119
120/** get a new job id for a new set of jobs */
121SCIP_EXPORT
123 void
124 );
125
126/** submit a job for parallel processing; the return value is a globally defined status */
127SCIP_EXPORT
129 SCIP_JOB* job, /**< pointer to the job to be submitted */
130 SCIP_SUBMITSTATUS* status /**< pointer to store the job's submit status */
131 );
132
133/** blocks until all jobs of the given jobid have finished
134 * and then returns the smallest SCIP_RETCODE of all the jobs
135 */
136SCIP_EXPORT
138 int jobid /**< the jobid of the jobs to wait for */
139 );
140
141/** initializes tpi */
142SCIP_EXPORT
144 int nthreads, /**< the number of threads to be used */
145 int queuesize, /**< the size of the queue */
146 /*TODO: specify and implement behaviour of blockwhenfull flag*/
147 SCIP_Bool blockwhenfull /**< should the queue block when full */
148 );
149
150/** deinitializes the tpi */
151SCIP_EXPORT
153 void
154 );
155
156/** indicate whether a working TPI is available */
157SCIP_EXPORT
159
160/** get name of library that the TPI interfaces to */
161SCIP_EXPORT
163 char* name, /**< buffer to store name */
164 int namesize /**< length of name buffer */
165 );
166
167/** get description of library that the TPI interfaces to */
168SCIP_EXPORT
170 char* desc, /**< buffer to store description */
171 int descsize /**< length of description */
172 );
173
174#endif
common defines and data types used in all packages of SCIP
#define SCIP_Bool
Definition: def.h:91
SCIP_Bool SCIPtpiIsAvailable(void)
Definition: tpi_none.c:225
SCIP_RETCODE SCIPtpiWaitCondition(SCIP_CONDITION *condition, SCIP_LOCK *lock)
Definition: tpi_none.c:125
SCIP_RETCODE SCIPtpiCreateJob(SCIP_JOB **job, int jobid, SCIP_RETCODE(*jobfunc)(void *args), void *jobarg)
Definition: tpi_none.c:156
SCIP_RETCODE SCIPtpiSignalCondition(SCIP_CONDITION *condition)
Definition: tpi_none.c:107
SCIP_RETCODE SCIPtpiAcquireLock(SCIP_LOCK *lock)
Definition: tpi_none.c:65
SCIP_RETCODE SCIPtpiExit(void)
Definition: tpi_none.c:217
SCIP_RETCODE SCIPtpiBroadcastCondition(SCIP_CONDITION *condition)
Definition: tpi_none.c:115
SCIP_RETCODE SCIPtpiSubmitJob(SCIP_JOB *job, SCIP_SUBMITSTATUS *status)
Definition: tpi_none.c:180
void SCIPtpiDestroyLock(SCIP_LOCK **lock)
Definition: tpi_none.c:56
void SCIPtpiGetLibraryDesc(char *desc, int descsize)
Definition: tpi_none.c:242
SCIP_RETCODE SCIPtpiCollectJobs(int jobid)
Definition: tpi_none.c:193
int SCIPtpiGetThreadNum(void)
Definition: tpi_none.c:142
int SCIPtpiGetNumThreads(void)
Definition: tpi_none.c:134
void SCIPtpiDestroyCondition(SCIP_CONDITION **condition)
Definition: tpi_none.c:98
int SCIPtpiGetNewJobID(void)
Definition: tpi_none.c:172
void SCIPtpiGetLibraryName(char *name, int namesize)
Definition: tpi_none.c:231
SCIP_RETCODE SCIPtpiInitLock(SCIP_LOCK **lock)
Definition: tpi_none.c:45
SCIP_RETCODE SCIPtpiReleaseLock(SCIP_LOCK *lock)
Definition: tpi_none.c:73
SCIP_RETCODE SCIPtpiInitCondition(SCIP_CONDITION **condition)
Definition: tpi_none.c:87
SCIP_RETCODE SCIPtpiInit(int nthreads, int queuesize, SCIP_Bool blockwhenfull)
Definition: tpi_none.c:203
type definitions for return codes for SCIP methods
enum SCIP_Retcode SCIP_RETCODE
Definition: type_retcode.h:63
the type definitions for the task processing interface
enum SCIP_Submitstatus SCIP_SUBMITSTATUS
Definition: type_tpi.h:50