Skip to content
Snippets Groups Projects
main.cpp 375 B
Newer Older
数学の武士's avatar
.
数学の武士 committed
#include "memory-holder.h"

int main(void)
{
    const size_t required_size = sizeof(float) * 100;
    memBuf<MemType::CPU> Buf(required_size);
数学の武士's avatar
.  
数学の武士 committed
    memBuf<MemType::GPU> Buf_gpu(required_size);
数学の武士's avatar
,  
数学の武士 committed

数学の武士's avatar
,  
数学の武士 committed
    float* ptr = static_cast<float*>(Buf.ptr());
数学の武士's avatar
.  
数学の武士 committed
    float* ptr_gpu = static_cast<float*>(Buf_gpu.ptr());
数学の武士's avatar
,  
数学の武士 committed

数学の武士's avatar
,  
数学の武士 committed
    for (int i = 0; i < 100; i++)
    {
数学の武士's avatar
,  
数学の武士 committed
        ptr[i] = float(i);
数学の武士's avatar
,  
数学の武士 committed
    }
数学の武士's avatar
.
数学の武士 committed
}