1 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ 2 /* */ 3 /* This file is part of the program and library */ 4 /* SCIP --- Solving Constraint Integer Programs */ 5 /* */ 6 /* Copyright (c) 2002-2023 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_none.c 26 * @ingroup TASKINTERFACE 27 * @brief the interface functions for dummy tpi 28 * @author Stephen J. Maher 29 * @author Leona Gottwald 30 * @author Marc Pfetsch 31 */ 32 33 /*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/ 34 35 #include "tpi/tpi.h" 36 37 /* do not define struct SCIP_Lock and struct SCIP_Condition, since they are not used */ 38 39 /* 40 * locks 41 */ 42 43 /** initializes the given lock */ 44 SCIP_RETCODE SCIPtpiInitLock( 45 SCIP_LOCK** lock /**< the lock */ 46 ) 47 { 48 assert(lock != NULL); 49 *lock = NULL; 50 51 return SCIP_OKAY; 52 } 53 54 /** destroys the given lock */ 55 void SCIPtpiDestroyLock( 56 SCIP_LOCK** lock /**< the lock */ 57 ) 58 { 59 assert(lock != NULL); 60 *lock = NULL; 61 } 62 63 /** acquires the given lock */ 64 SCIP_RETCODE SCIPtpiAcquireLock( 65 SCIP_LOCK* lock /**< the lock */ 66 ) 67 { /*lint --e{715}*/ 68 return SCIP_OKAY; 69 } 70 71 /** releases the given lock */ 72 SCIP_RETCODE SCIPtpiReleaseLock( 73 SCIP_LOCK* lock /**< the lock */ 74 ) 75 { /*lint --e{715}*/ 76 return SCIP_OKAY; 77 } 78 79 80 81 /* 82 * conditions 83 */ 84 85 /** initializes the given condition variable */ 86 SCIP_RETCODE SCIPtpiInitCondition( 87 SCIP_CONDITION** condition /**< condition to be created and initialized */ 88 ) 89 { 90 assert(condition != NULL); 91 *condition = NULL; 92 93 return SCIP_OKAY; 94 } 95 96 /** destroys the given condition variable */ 97 void SCIPtpiDestroyCondition( 98 SCIP_CONDITION** condition /**< condition to be destroyed and freed */ 99 ) 100 { 101 assert(condition != NULL); 102 *condition = NULL; 103 } 104 105 /** signals one waiting thread */ 106 SCIP_RETCODE SCIPtpiSignalCondition( 107 SCIP_CONDITION* condition /**< the condition variable to signal */ 108 ) 109 { /*lint --e{715}*/ 110 return SCIP_OKAY; 111 } 112 113 /** signals all waiting threads */ 114 SCIP_RETCODE SCIPtpiBroadcastCondition( 115 SCIP_CONDITION* condition /**< the condition variable to broadcast */ 116 ) 117 { /*lint --e{715}*/ 118 return SCIP_OKAY; 119 } 120 121 /** waits on a condition variable. The given lock must be held by the caller and will 122 * be held when this function returns. 123 */ 124 SCIP_RETCODE SCIPtpiWaitCondition( 125 SCIP_CONDITION* condition, /**< the condition variable to wait on */ 126 SCIP_LOCK* lock /**< the lock that is held by the caller */ 127 ) 128 { /*lint --e{715}*/ 129 return SCIP_OKAY; 130 } 131 132 /** returns the number of threads */ 133 int SCIPtpiGetNumThreads( 134 void 135 ) 136 { 137 return 1; 138 } 139 140 /** returns the thread number */ 141 int SCIPtpiGetThreadNum( 142 void 143 ) 144 { 145 return 0; 146 } 147 148 149 150 /* 151 * other functions 152 */ 153 154 /** creates a job for parallel processing */ 155 SCIP_RETCODE SCIPtpiCreateJob( 156 SCIP_JOB** job, /**< pointer to the job that will be created */ 157 int jobid, /**< the id for the current job */ 158 SCIP_RETCODE (*jobfunc)(void* args),/**< pointer to the job function */ 159 void* jobarg /**< the job's argument */ 160 ) 161 { 162 SCIP_UNUSED( job ); 163 SCIP_UNUSED( jobid ); 164 SCIP_UNUSED( jobfunc ); 165 SCIP_UNUSED( jobarg ); 166 167 return SCIP_ERROR; 168 } 169 170 /** get a new job id for a new set of jobs */ 171 int SCIPtpiGetNewJobID( 172 void 173 ) 174 { 175 return 0; 176 } 177 178 /** submit a job for parallel processing; the return value is a globally defined status */ 179 SCIP_RETCODE SCIPtpiSubmitJob( 180 SCIP_JOB* job, /**< pointer to the job to be submitted */ 181 SCIP_SUBMITSTATUS* status /**< pointer to store the job's submit status */ 182 ) 183 { 184 SCIP_UNUSED( job ); 185 SCIP_UNUSED( status ); 186 187 return SCIP_ERROR; 188 } 189 190 /** Blocks until all jobs with the given jobid have finished and then returns the smallest SCIP_RETCODE of all the 191 * jobs */ 192 SCIP_RETCODE SCIPtpiCollectJobs( 193 int jobid /**< the id of the jobs to collect */ 194 ) 195 { 196 SCIP_UNUSED( jobid ); 197 198 return SCIP_ERROR; 199 } 200 201 /** initializes tpi */ 202 SCIP_RETCODE SCIPtpiInit( 203 int nthreads, /**< the number of threads to be used */ 204 int queuesize, /**< the size of the queue */ 205 SCIP_Bool blockwhenfull /**< should the queue block when full */ 206 ) 207 { 208 SCIP_UNUSED( nthreads ); 209 SCIP_UNUSED( queuesize ); 210 SCIP_UNUSED( blockwhenfull ); 211 212 return SCIP_ERROR; 213 } 214 215 /** deinitializes the tpi */ 216 SCIP_RETCODE SCIPtpiExit( 217 void 218 ) 219 { 220 return SCIP_ERROR; 221 } 222