Skip to content

Instantly share code, notes, and snippets.

View pranavsharma's full-sized avatar

Pranav Sharma pranavsharma

View GitHub Profile
// Copyright(c) Microsoft Corporation.All rights reserved.
// Licensed under the MIT License.
//
#include <assert.h>
#include <onnxruntime_c_api.h>
#include <cmath>
#include <stdlib.h>
#include <stdio.h>
#include <vector>
/*
Program to demonstrate using one session and multiple threads to call Run on that session.
g++ -std=c++17 -o test_ort_one_session_multiple_threads test_ort_one_session_multiple_threads.cc -I onnxruntime-linux-x64-1.15.1/include/ -lonnxruntime -Lonnxruntime-linux-x64-1.15.1/lib/ -lpthread -Wl,-rpath,/home/pranav/onnxruntime-linux-x64-1.15.1/lib/
Author: Github id: pranavsharma)
*/
#include <onnxruntime_cxx_api.h>
#include <vector>
#include <string>
#include <iostream>
// Author: Pranav Sharma
#include <pybind11/pybind11.h>
#include <pybind11/functional.h>
#include <thread>
#include <iostream>
#include <chrono>
#include <mutex>
#include <queue>
#define STRINGIFY(x) #x
// Author: Pranav Sharma
#include <pybind11/pybind11.h>
#include <pybind11/functional.h>
#include <thread>
#include <iostream>
#include <chrono>
#define STRINGIFY(x) #x
#define MACRO_STRINGIFY(x) STRINGIFY(x)
using Microsoft.ML.OnnxRuntime;
using Microsoft.ML.OnnxRuntime.Tensors;
using System;
using System.Buffers;
using System.IO;
var session = new InferenceSession("C:\\Users\\prs\\model.onnx", SessionOptions.MakeSessionOptionWithCudaProvider(0)); // return (x + y) * 2
int batch_size = 10000;
IDisposableReadOnlyCollection<DisposableNamedOnnxValue> prevOutput = null;
var ortGpuMemoryInfo = new OrtMemoryInfo(OrtMemoryInfo.allocatorCUDA, OrtAllocatorType.DeviceAllocator, 0, OrtMemType.Default);
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <curl/curl.h>
int main(void) {
CURL *curl;
CURLcode res;
// Set the API endpoint and the authentication token
# issue 15206 OptionalGetElement
import numpy as np
import onnx
from onnx import TensorProto
from onnx.helper import (
make_model, make_node, make_graph,
make_tensor_value_info, make_value_info)
from onnx.checker import check_model
#include <assert.h>
#include <onnxruntime_cxx_api.h>
#include <cmath>
#include <stdlib.h>
#include <stdio.h>
#include <vector>
#include <iostream>
using namespace Ort;
root@d9f3a6d38dc9:/opt/tritonserver/qa/L0_io# LD_LIBRARY_PATH=/opt/tritonserver/lib ./memory_alloc -i 0 -o -1 -r /opt/tritonserver/qa/L0_io/models -m onnx_float32_float32
_float32
I0505 23:42:49.968124 643 libtorch.cc:1381] TRITONBACKEND_Initialize: pytorch
I0505 23:42:49.968240 643 libtorch.cc:1391] Triton TRITONBACKEND API version: 1.9
I0505 23:42:49.968253 643 libtorch.cc:1397] 'pytorch' TRITONBACKEND API version: 1.9
2022-05-05 23:42:50.145089: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library libcudart.so.11.0
I0505 23:42:50.185708 643 tensorflow.cc:2181] TRITONBACKEND_Initialize: tensorflow
I0505 23:42:50.185750 643 tensorflow.cc:2191] Triton TRITONBACKEND API version: 1.9
I0505 23:42:50.185765 643 tensorflow.cc:2197] 'tensorflow' TRITONBACKEND API version: 1.9
I0505 23:42:50.185775 643 tensorflow.cc:2221] backend configuration:
//#include <opencv2/highgui/highgui.hpp>
//#include <opencv2/imgproc/imgproc.hpp>
#include <onnxruntime_cxx_api.h>
///#include <cuda_provider_factory.h>
/////#include <tensorrt_provider_factory.h>
#include <bits/stdc++.h>
// using namespace cv;
using namespace std;