src/main.cpp
/// ***************************************************************************************************************************
/// Test for running vector addition with OpenCL on any heterogeneous device (e.g., a GPU).
/// OCLVM runs a sequential BC interpreter on the GPU. This means that ProtoVM launches a single
/// thread kernel that runs the whole application on the device.
/// ***************************************************************************************************************************
Test for running vector addition with OpenCL on any heterogeneous device .
OCLVM runs a sequential BC interpreter on the GPU. This means that ProtoVM launches a single
thread kernel that runs the whole application on the device.
Test for running vector addition with OpenCL on any heterogeneous device . OCLVM runs a sequential BC interpreter on the GPU . This means that ProtoVM launches a single thread kernel that runs the whole application on the device .
void testVectorAdditionOpenCL() {
    vector<int> vectorAdd = {
            ICONST, 0,
            DUP,
            ICONST, 10,
            IEQ,
            BRT, 23,
            DUP,    
            DUP,    
            GLOAD_INDEXED, 10,
            LOAD, 1,   
            GLOAD_INDEXED, 20,
            IADD,
            GSTORE_INDEXED, 0,
            ICONST1,
            IADD,
            BR, 2,
            POP,
            HALT
    };
    OCLVM oclVM(vectorAdd, 0);    
    oclVM.setVMConfig(100, 100);
    oclVM.setTrace();
    oclVM.setPlatform(0);
    oclVM.initHeap();
    oclVM.initOpenCL("lib/interpreter.cl", false);
    oclVM.runInterpreter();
    oclVM.printHeap();
    cout << endl;
}
void testVectorAdditionOpenCL ( ) { vector < int > vectorAdd = { ICONST , 0 , DUP , ICONST , 10 , IEQ , BRT , 23 , DUP , DUP , GLOAD_INDEXED , 10 , LOAD , 1 , GLOAD_INDEXED , 20 , IADD , GSTORE_INDEXED , 0 , ICONST1 , IADD , BR , 2 , POP , HALT } ; OCLVM oclVM ( vectorAdd , 0 ) ; oclVM . setVMConfig ( 100 , 100 ) ; oclVM . setTrace ( ) ; oclVM . setPlatform ( 0 ) ; oclVM . initHeap ( ) ; oclVM . initOpenCL ( " " , false ) ; oclVM . runInterpreter ( ) ; oclVM . printHeap ( ) ; cout << endl ; }
Test for running vector addition with OpenCL on any heterogeneous device (e.g., a GPU).
Test for running vector addition with OpenCL on any heterogeneous device ( e . g . a GPU ) .
// Vector addition in a LOOP // offset for each array to load // offset for each array to load // load from position 1 /// OpenCL BC interpreter (single-thread).