Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expose avx512_qsort functions to C programs #55

Closed
wants to merge 1 commit into from

Conversation

r-devulap
Copy link
Contributor

Build and use avx512_qsort in a C program using the following C functions:

void int16_avx512_qsort(int16_t* arr, int64_t arrsize)
void uint16_avx512_qsort(uint16_t* arr, int64_t arrsize)
void float16_avx512_qsort(uint16_t* arr, int64_t arrsize)
void int32_avx512_qsort(int32_t* arr, int64_t arrsize)
void uint32_avx512_qsort(uint32_t* arr, int64_t arrsize)
void float_avx512_qsort(float* arr, int64_t arrsize)
void int64_avx512_qsort(int64_t* arr, int64_t arrsize)
void uint64_avx512_qsort(uint64_t* arr, int64_t arrsize)
void double_avx512_qsort(double* arr, int64_t arrsize)

Example main.c:


#include <stdint.h>
void double_avx512_qsort(double*, int64_t);

int main() {
    const int ARRSIZE = 1000;
    double arr[ARRSIZE];

    /* Initialize elements is reverse order */
    for (int ii = 0; ii < ARRSIZE; ++ii) {
        arr[ii] = ARRSIZE - ii;
    }

    /* call avx512 quicksort */
    double_avx512_qsort(arr, ARRSIZE);
    return 0;
}

Steps to build:

g++ -c -fpic -x c++ avx512-64bit-qsort.hpp -o avx512qsort.o -march=skylake-avx512 -O3
gcc main.c avx512qsort.o -lm

@r-devulap r-devulap closed this Dec 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant