#include <limits.h>
#include <omp.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
Include dependency graph for sort-1.c:
Go to the source code of this file.
Data Structures | |
struct | int_pair |
struct | int_pair_stack |
Defines | |
#define | THRESHOLD 100 |
#define | STACK_SIZE 4 * CHAR_BIT * sizeof (int) |
Functions | |
static void | verify (const char *name, double stime, int *array, int count) |
static void | insertsort (int *array, int s, int e) |
static void | init_int_pair_stack (struct int_pair_stack *stack) |
static void | push_int_pair_stack (struct int_pair_stack *stack, int lo, int hi) |
static void | pop_int_pair_stack (struct int_pair_stack *stack, int *lo, int *hi) |
static int | size_int_pair_stack (struct int_pair_stack *stack) |
static void | busy_wait (void) |
static void | swap (int *array, int a, int b) |
static int | choose_pivot (int *array, int lo, int hi) |
static int | partition (int *array, int lo, int hi) |
static void | sort1 (int *array, int count) |
static void | sort2_1 (int *array, int lo, int hi, int num_threads, int *busy) |
static void | sort2 (int *array, int count) |
int | main (int argc, char **argv) |
Variables | |
int | failures |
#define STACK_SIZE 4 * CHAR_BIT * sizeof (int) |
static void busy_wait | ( | void | ) | [inline, static] |
static int choose_pivot | ( | int * | array, | |
int | lo, | |||
int | hi | |||
) | [inline, static] |
Definition at line 122 of file sort-1.c.
References swap().
Referenced by partition().
Here is the call graph for this function:
Here is the caller graph for this function:
static void init_int_pair_stack | ( | struct int_pair_stack * | stack | ) | [inline, static] |
Definition at line 72 of file sort-1.c.
References int_pair_stack::arr, and int_pair_stack::top.
Referenced by sort1().
Here is the caller graph for this function:
static void insertsort | ( | int * | array, | |
int | s, | |||
int | e | |||
) | [static] |
int main | ( | int | argc, | |
char ** | argv | |||
) |
Definition at line 334 of file sort-1.c.
References count, i, num_threads, omp_get_num_threads(), omp_get_wtime(), omp_set_dynamic(), omp_set_nested(), sort1(), sort2(), and verify().
Here is the call graph for this function:
static int partition | ( | int * | array, | |
int | lo, | |||
int | hi | |||
) | [inline, static] |
static void pop_int_pair_stack | ( | struct int_pair_stack * | stack, | |
int * | lo, | |||
int * | hi | |||
) | [inline, static] |
Definition at line 86 of file sort-1.c.
References int_pair::hi, int_pair::lo, and int_pair_stack::top.
Referenced by sort1().
Here is the caller graph for this function:
static void push_int_pair_stack | ( | struct int_pair_stack * | stack, | |
int | lo, | |||
int | hi | |||
) | [inline, static] |
Definition at line 78 of file sort-1.c.
References int_pair::hi, int_pair::lo, and int_pair_stack::top.
Referenced by sort1().
Here is the caller graph for this function:
static int size_int_pair_stack | ( | struct int_pair_stack * | stack | ) | [inline, static] |
Definition at line 94 of file sort-1.c.
References int_pair_stack::arr, and int_pair_stack::top.
Referenced by sort1().
Here is the caller graph for this function:
static void sort1 | ( | int * | array, | |
int | count | |||
) | [static] |
Definition at line 156 of file sort-1.c.
References busy_wait(), init_int_pair_stack(), insertsort(), lock, num_threads, omp_get_num_threads(), omp_get_thread_num(), partition(), pop_int_pair_stack(), push_int_pair_stack(), size_int_pair_stack(), STACK_SIZE, and THRESHOLD.
Referenced by main().
Here is the call graph for this function:
Here is the caller graph for this function:
static void sort2 | ( | int * | array, | |
int | count | |||
) | [static] |
Definition at line 294 of file sort-1.c.
References num_threads, omp_get_num_threads(), and sort2_1().
Referenced by main().
Here is the call graph for this function:
Here is the caller graph for this function:
static void sort2_1 | ( | int * | array, | |
int | lo, | |||
int | hi, | |||
int | num_threads, | |||
int * | busy | |||
) | [static] |
Definition at line 257 of file sort-1.c.
References insertsort(), omp_get_thread_num(), partition(), and THRESHOLD.
Referenced by sort2().
Here is the call graph for this function:
Here is the caller graph for this function:
static void swap | ( | int * | array, | |
int | a, | |||
int | b | |||
) | [inline, static] |
Definition at line 114 of file sort-1.c.
Referenced by choose_pivot(), and partition().
Here is the caller graph for this function:
static void verify | ( | const char * | name, | |
double | stime, | |||
int * | array, | |||
int | count | |||
) | [static] |