Orochi is a library that dynamically loads HIP and CUDA APIs, allowing users to switch APIs at runtime.

Using Orochi eliminates the need to compile separate implementations for each API. Just compile and maintain a single binary that runs on AMD and NVIDIA GPUs.

Unlike HIP which uses hipamd or CUDA at compile time, Orochi will dynamically load the corresponding HIP/CUDA shared library depending on the platform used. In other words, it combines the functionality provided by HIPEW and CUEW into one library.

Require

This library does not require you to link against CUDA (for the driver API) or HIP (for the driver and runtime API) at build time.

If you are not using the runtime API, you do not need to install the HIP SDK on the machine or the CUDA SDK.

To run an application compiled with Orochi, the driver of choice and the corresponding .dll/.so file based on the available GPU needs to be installed. Orochi will automatically link the corresponding shared library at runtime.

API example

API has oroprefix, if you are familiar with CUDA or HIP driver API, it will be easy to get used to the Orochi API.

For example, consider the following HIP code for device and context creation:

#include <hip/hip_runtime.h>

hipInit( 0 );
hipDevice device;
hipDeviceGet( &device, 0 );
hipCtx ctx;
hipCtxCreate( &ctx, 0, device );

The same code can be rewritten using Orochi as:

#include <Orochi/Orochi.h>

oroInitialize( ORO_API_HIP, 0 );
oroInit( 0 );
oroDevice device;
oroDeviceGet( &device, 0 );
oroCtx ctx;
oroCtxCreate( &ctx, 0, device );

It will run on CUDA and HIP at runtime!

See more information in the sample application.

#Orochi #Homepage #Documentation #Downloads #HIP #CUDA #API #Dynamic #Processing #News Fast Delivery

Leave a Comment

Your email address will not be published. Required fields are marked *