Scippy

    SCIP

    Solving Constraint Integer Programs

    tpi_none.c
    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-2025 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#include "scip/pub_misc.h"
    37
    38/* do not define struct SCIP_Lock and struct SCIP_Condition, since they are not used */
    39
    40/*
    41 * locks
    42 */
    43
    44/** initializes the given lock */
    46 SCIP_LOCK** lock /**< the lock */
    47 )
    48{
    49 assert(lock != NULL);
    50 *lock = NULL;
    51
    52 return SCIP_OKAY;
    53}
    54
    55/** destroys the given lock */
    57 SCIP_LOCK** lock /**< the lock */
    58 )
    59{
    60 assert(lock != NULL);
    61 *lock = NULL;
    62}
    63
    64/** acquires the given lock */
    66 SCIP_LOCK* lock /**< the lock */
    67 )
    68{ /*lint --e{715}*/
    69 return SCIP_OKAY;
    70}
    71
    72/** releases the given lock */
    74 SCIP_LOCK* lock /**< the lock */
    75 )
    76{ /*lint --e{715}*/
    77 return SCIP_OKAY;
    78}
    79
    80
    81
    82/*
    83 * conditions
    84 */
    85
    86/** initializes the given condition variable */
    88 SCIP_CONDITION** condition /**< condition to be created and initialized */
    89 )
    90{
    91 assert(condition != NULL);
    92 *condition = NULL;
    93
    94 return SCIP_OKAY;
    95}
    96
    97/** destroys the given condition variable */
    99 SCIP_CONDITION** condition /**< condition to be destroyed and freed */
    100 )
    101{
    102 assert(condition != NULL);
    103 *condition = NULL;
    104}
    105
    106/** signals one waiting thread */
    108 SCIP_CONDITION* condition /**< the condition variable to signal */
    109 )
    110{ /*lint --e{715}*/
    111 return SCIP_OKAY;
    112}
    113
    114/** signals all waiting threads */
    116 SCIP_CONDITION* condition /**< the condition variable to broadcast */
    117 )
    118{ /*lint --e{715}*/
    119 return SCIP_OKAY;
    120}
    121
    122/** waits on a condition variable. The given lock must be held by the caller and will
    123 * be held when this function returns.
    124 */
    126 SCIP_CONDITION* condition, /**< the condition variable to wait on */
    127 SCIP_LOCK* lock /**< the lock that is held by the caller */
    128 )
    129{ /*lint --e{715}*/
    130 return SCIP_OKAY;
    131}
    132
    133/** returns the number of threads */
    135 void
    136 )
    137{
    138 return 1;
    139}
    140
    141/** returns the thread number */
    143 void
    144 )
    145{
    146 return 0;
    147}
    148
    149
    150
    151/*
    152 * other functions
    153 */
    154
    155/** creates a job for parallel processing */
    157 SCIP_JOB** job, /**< pointer to the job that will be created */
    158 int jobid, /**< the id for the current job */
    159 SCIP_RETCODE (*jobfunc)(void* args),/**< pointer to the job function */
    160 void* jobarg /**< the job's argument */
    161 )
    162{
    163 SCIP_UNUSED( job );
    164 SCIP_UNUSED( jobid );
    165 SCIP_UNUSED( jobfunc );
    166 SCIP_UNUSED( jobarg );
    167
    168 return SCIP_ERROR;
    169}
    170
    171/** get a new job id for a new set of jobs */
    173 void
    174 )
    175{
    176 return 0;
    177}
    178
    179/** submit a job for parallel processing; the return value is a globally defined status */
    181 SCIP_JOB* job, /**< pointer to the job to be submitted */
    182 SCIP_SUBMITSTATUS* status /**< pointer to store the job's submit status */
    183 )
    184{
    185 SCIP_UNUSED( job );
    186 SCIP_UNUSED( status );
    187
    188 return SCIP_ERROR;
    189}
    190
    191/** Blocks until all jobs with the given jobid have finished and then returns the smallest SCIP_RETCODE of all the
    192 * jobs */
    194 int jobid /**< the id of the jobs to collect */
    195 )
    196{
    197 SCIP_UNUSED( jobid );
    198
    199 return SCIP_ERROR;
    200}
    201
    202/** initializes tpi */
    204 int nthreads, /**< the number of threads to be used */
    205 int queuesize, /**< the size of the queue */
    206 SCIP_Bool blockwhenfull /**< should the queue block when full */
    207 )
    208{
    209 SCIP_UNUSED( nthreads );
    210 SCIP_UNUSED( queuesize );
    211 SCIP_UNUSED( blockwhenfull );
    212
    213 return SCIP_ERROR;
    214}
    215
    216/** deinitializes the tpi */
    218 void
    219 )
    220{
    221 return SCIP_ERROR;
    222}
    223
    224/** indicate whether a working TPI is available */
    226{
    227 return FALSE;
    228}
    229
    230/** get name of library that the TPI interfaces to */
    232 char* name, /**< buffer to store name */
    233 int namesize /**< length of name buffer */
    234 )
    235{
    236 assert(name != NULL);
    237
    238 (void) SCIPsnprintf(name, namesize, "none");
    239}
    240
    241/** get description of library that the TPI interfaces to */
    243 char* desc, /**< buffer to store description */
    244 int descsize /**< length of description */
    245 )
    246{
    247 assert(desc != NULL);
    248 assert(descsize >= 1);
    249
    250 *desc = '\0';
    251}
    #define NULL
    Definition: def.h:248
    #define SCIP_UNUSED(x)
    Definition: def.h:409
    #define SCIP_Bool
    Definition: def.h:91
    #define FALSE
    Definition: def.h:94
    int SCIPsnprintf(char *t, int len, const char *s,...)
    Definition: misc.c:10827
    public data structures and miscellaneous methods
    the type definitions for the SCIP parallel interface
    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
    @ SCIP_OKAY
    Definition: type_retcode.h:42
    @ SCIP_ERROR
    Definition: type_retcode.h:43
    enum SCIP_Retcode SCIP_RETCODE
    Definition: type_retcode.h:63
    enum SCIP_Submitstatus SCIP_SUBMITSTATUS
    Definition: type_tpi.h:50