Giter Club home page Giter Club logo

simd's Introduction

SIMD Operations Example with Criterion Testing

This project demonstrates the use of Single Instruction, Multiple Data (SIMD) operations for Intel/AMD (using SSE) and ARM (using NEON) architectures in C, along with unit testing using the Criterion testing framework.

Project Structure

  • simd_operations.c and simd_operations.h: Contain the implementation of SIMD operations.
  • test_simd_operations.c: Contains the Criterion-based unit tests for the SIMD operations.
  • Makefile (Optional): Can be used to automate compilation and testing.

Installing Criterion

Criterion is a cross-platform C and C++ testing framework. Follow these steps to install Criterion:

On Linux

  1. Using a Package Manager (Debian/Ubuntu):

    sudo apt-get install libcriterion-dev
  2. From Source:

    • Install the necessary dependencies.
    • Clone the Criterion repository:
      git clone --recursive https://github.com/Snaipe/Criterion.git
    • Build and install:
      mkdir Criterion/build && cd Criterion/build
      cmake ..
      make
      sudo make install

Compiling the SIMD Operations

gcc -o test_simd test_simd_operations.c simd_operations.c -lcriterion

Writing and Running Tests

  1. Write Tests:

    • Place your tests in test_simd_operations.c. Use the Criterion API to define test cases.
  2. Compile the Tests:

    • Ensure Criterion is installed and accessible to your compiler.
    • Compile the test file along with the SIMD operation sources and link against Criterion:
      gcc -o test_simd test_simd_operations.c simd_operations.c -lcriterion
  3. Run the Tests:

    • Execute the compiled test binary:
      ./test_simd

Note on SIMD Architectures

  • This example includes code paths for both SSE (Intel/AMD) and NEON (ARM). Ensure your compiler supports the SIMD instructions for your target architecture.
  • Use appropriate compiler flags if necessary, e.g., -msse2 for SSE2 or -march=armv8-a+simd for ARM NEON.

For more detailed information about Criterion and its usage, refer to the official Criterion documentation.

simd's People

Contributors

bspguy avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.