     }
 }
 
+cudaStream_t* streams;
+
+extern "C" void cuda_create_streams(int num_streams)
+{
+    streams = (cudaStream_t*)malloc(num_streams * sizeof(cudaStream_t));
+    for (int i = 0; i < num_streams; i++) cudaStreamCreate(&streams[i]);
+}
+
+extern "C" void cuda_destroy_streams(int num_streams)
+{
+    for (int i = 0; i < num_streams; i++) cudaStreamDestroy(streams[i]);
+    free(streams);
+}
+
+extern "C" void cuda_stream_synchronize(int stream_id)
+{
+    if (cudaStreamSynchronize(streams[stream_id]) != cudaSuccess)
+    {
+        printf("failed to execute cudaStreamSynchronize()\n");
+        exit(0);
+    }
+}
+
+extern "C" void cuda_async_copy_to_device(void *target, void *source, size_t size, int stream_id)
+{
+    cudaStream_t stream = (stream_id == -1) ? NULL : streams[stream_id];
+
+    if (cudaMemcpyAsync(target, source, size, cudaMemcpyHostToDevice, stream) != cudaSuccess)
+    {
+        printf("failed to execute cudaMemcpy(cudaMemcpyHostToDevice)\n");
+        exit(0);
+    }
+}
+
+extern "C" void cuda_async_copy_to_host(void *target, void *source, size_t size, int stream_id)
+{
+    cudaStream_t stream = (stream_id == -1) ? NULL : streams[stream_id];
+
+    if (cudaMemcpyAsync(target, source, size, cudaMemcpyDeviceToHost, stream) != cudaSuccess)
+    {
+        printf("failed to execute cudaMemcpy(cudaMemcpyDeviceToHost)\n");
+        exit(0);
+    }
+}
+
 extern "C" void cuda_memset(void *ptr,int value, size_t size)
 {
     if (cudaMemset(ptr, value, size) != cudaSuccess)

//* 
//*     return devprop;
//* }


extern "C" void cuda_device_info()
{

    }
}

extern "C" void cuda_host_register(void* ptr, size_t size)
{
    assert(ptr);
    
    cudaError_t err = cudaHostRegister(ptr, size, 0);
    if (err != cudaSuccess)
    {
        printf("failed to execute cudaHostRegister\n");
        switch (err)
        {
            case cudaErrorInvalidValue:
                printf("cudaErrorInvalidValue\n");
                break;
            case cudaErrorMemoryAllocation:
                printf("cudaErrorMemoryAllocation\n");
                break;
            default:
                printf("unrecognized error\n");
        }
        exit(-1);
    }
}

extern "C" void cuda_host_unregister(void* ptr)
{
    if (cudaHostUnregister(ptr) != cudaSuccess)
    {
        printf("failed to execute cudaHostUnregister\n");
        exit(-1);
    }
}

//* cudaDeviceProp& cuda_devprop()
//* {
