Skip to content

Instantly share code, notes, and snippets.

View csullivan's full-sized avatar

Chris Sullivan csullivan

  • NVIDIA
  • Portland
View GitHub Profile
@csullivan
csullivan / bcdedit.txt
Last active October 30, 2021 23:41
Repairing EFI/GPT Bootloader using the DISKPART and BCDEdit command
Source: https://www.retrospect.com/au/support/kb/repair_efi_bootloader
This guide details how to rebuild the BCD boot store for windows.
Use diskpart to make System partition available.
(This will allow us to use bcdedit later in this guide to repair the bootloader.)
Boot from the Windows installation media

Ubuntu 18.04 VFIO GPU passthrough with a single GPU (onboard automatically disables itself)

On an Ubuntu 18.04 system with two NVIDIA GPUs only the change to Grub below was necessary, I did not need to mess with modprobe or initramfs. In addition, I needed to set the PCI bus for the correct nvidia xconfig to the non-blacklisted GPU following these steps

sudo nvidia-xconfig

This will create a new xorg config at /etc/X11/xorg.conf.

Then add the BusID line in the following part of the file /etc/X11/xorg.conf:

@csullivan
csullivan / launch_rpc.sh
Created September 28, 2021 23:07
Expect script to restart TVM RPC server on Android after crash
#!/bin/bash
function run() {
device_id=$1
echo "Starting rpc server on adb device: $device_id"
preamble='
spawn adb -s'
body='shell
expect "#"
set cmd "cd /data/local/tmp/; LD_LIBRARY_PATH=/data/local/tmp /data/local/tmp/tvm_rpc server --tracker=IP_ADDRESS:PORT --key=\"your_key_here\""
send $cmd
import tvm
from tvm import te
def intrin_vadd(xo, m, n):
x = te.placeholder((n,), name="vx")
y = te.placeholder((n,), name="vy")
if m % n == 0:
body = lambda i: x[i] + y[i]
else:
@csullivan
csullivan / kona_opencl_info.txt
Created July 31, 2020 22:56
Snapdragon 865 HDK OpenCL Info.
1 OpenCL Platforms found
CL_PLATFORM_NAME: QUALCOMM Snapdragon(TM)
CL_PLATFORM_VERSION: OpenCL 2.0 QUALCOMM build: commit #ffa098c changeid #I3cb6626e76 Date: 01/16/20 Thu Local Branch: Remote Branch:
OpenCL Device Info:
1 devices found supporting OpenCL on: QUALCOMM Snapdragon(TM)
----------------------------------
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
import argparse
import os
def get_files(directory):
files = os.listdir(path=directory)
pbtxts = []
for f in files:
if "pbtxt" in f:
pbtxts.append(f)
return pbtxts
diff --git a/src/ngraph/runtime/gpu/gpu_backend.cpp b/src/ngraph/runtime/gpu/gpu_backend.cpp
index 2f1472e4..f54d4ce0 100644
--- a/src/ngraph/runtime/gpu/gpu_backend.cpp
+++ b/src/ngraph/runtime/gpu/gpu_backend.cpp
@@ -162,6 +162,7 @@ bool runtime::gpu::GPU_Backend::call(shared_ptr<Function> func,
const vector<shared_ptr<runtime::Tensor>>& outputs,
const vector<shared_ptr<runtime::Tensor>>& inputs)
{
+ std::cout << "call " << func->get_name() << std::endl;
bool rc = true;
diff --git a/src/ngraph/runtime/gpu/gpu_external_function.cpp b/src/ngraph/runtime/gpu/gpu_external_function.cpp
index 71cdd614..e836f16b 100644
--- a/src/ngraph/runtime/gpu/gpu_external_function.cpp
+++ b/src/ngraph/runtime/gpu/gpu_external_function.cpp
@@ -561,7 +561,7 @@ void runtime::gpu::GPU_ExternalFunction::compile()
m_shared_context->m_primitive_emitter->get_memory_allocator());
ngraph::pass::Manager pass_manager;
-#if CUDNN_VERSION >= 7200
+#if CUDNN_VERSION >= 9200
diff --git a/src/ngraph/runtime/gpu/cuda_emitter.cpp b/src/ngraph/runtime/gpu/cuda_emitter.cpp
index a9ef0e00..09fe458b 100644
--- a/src/ngraph/runtime/gpu/cuda_emitter.cpp
+++ b/src/ngraph/runtime/gpu/cuda_emitter.cpp
@@ -3096,11 +3096,11 @@ void* runtime::gpu::CUDAEmitter::get_init_reduce_val(std::string reduce_op, std:
{
if (reduce_op == "max")
{
- return m_host_parameters->min_by_datatype(data_type);
+ return TypeInfo::Get(data_type)->max_ptr();