Skip to content
Snippets Groups Projects
cuda_queue.h 1.84 KiB
/*******************************************************************************
 * This file is part of QuickSched.
 * 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
 * by the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 * 
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU Lesser General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 * 
 ******************************************************************************/
#define cuda_max_unlock 128
#define cuda_numqueues 2


/** Struct for a task queue. */
struct queue_cuda {

    /* Indices to the first and last elements. */
    int first, last;
    
    /* Number of elements in this queue. */
    volatile int count;
    
    /* Number of elements in the recycled list. */
    volatile int rec_count;
    
    /* The queue data. */
    volatile int *data;
    
    /* The recycling list. */
    volatile int *rec_data;

    };


/** Struct for each task. */
struct task_cuda {

    /** Task type and subtype. */
    short int type, subtype;

    /** Wait counters. */
    volatile int wait;
    
    /** Task flags. */
    int flags;

    /** Indices of the cells involved. */
    int i, j;
    
    /** Nr of task that this task unlocks. */
    int nr_unlock;
    
    /** List of task that this task unlocks (dependencies). */
    int unlock[ cuda_max_unlock ];
    
    };