I want to compile an ispc program. I am trying to generate the executable for one of their example programs.
I have simple.cpp with the below content
#include <stdio.h>
#include <stdlib.h>
// Include the header file that the ispc compiler generates
#include "simple_ispc.h"
using namespace ispc;
int main() {
float vin[16], vout[16];
// Initialize input buffer
for (int i = 0; i < 16; ++i)
vin[i] = (float)i;
// Call simple() function from simple.ispc file
simple(vin, vout, 16);
// Print results
for (int i = 0; i < 16; ++i)
printf("%d: simple(%f) = %f\n", i, vin[i], vout[i]);
return 0;
}
I have simple.ispc with the below content
export void simple(uniform float vin[], uniform float vout[],
uniform int count) {
foreach (index = 0 ... count) {
// Load the appropriate input value for this program instance.
float v = vin[index];
// Do an arbitrary little computation, but at least make the
// computation dependent on the value being processed
if (v < 3.)
v = v * v;
else
v = sqrt(v);
// And write the result to the output array.
vout[index] = v;
}
}
I can use cmake https://github.com/ispc/ispc/tree/main/examples/cpu/simple to get the executable but I want to know the raw commands that I need to execute to run simple.cpp file. Can someone please tell how to compile and run the simple.cpp file with ispc?