Skip to content

Instantly share code, notes, and snippets.

@seddonm1
seddonm1 / gist:5dc956b136a98b8d46d03ca205252b4a
Last active February 23, 2024 04:51
How to build onnxruntime on an x86_64 with NVIDIA GPU with Docker
docker run \
--rm \
-it \
-e ONNXRUNTIME_REPO=https://github.com/microsoft/onnxruntime \
-e ONNXRUNTIME_COMMIT=v1.17.0 \
-e BUILD_CONFIG=Release \
-e CMAKE_VERSION=3.28.3 \
-e CUDA_ARCHITECTURES="70;75;80;86;89" \
--entrypoint "" \
-v $(pwd):/output \
@seddonm1
seddonm1 / gist:5927db05cb7ad38d98a22674fa82a4c6
Last active March 27, 2024 14:10
How to build onnxruntime on an aarch64 NVIDIA device (like Jetson Orin AGX)
On an Orin NX 16G the memory was too low to compile and the SWAP file had to be increased.
/etc/systemd/nvzramconfig.sh
change:
```
# Calculate memory to use for zram (1/2 of ram)
totalmem=`LC_ALL=C free | grep -e "^Mem:" | sed -e 's/^Mem: *//' -e 's/ *.*//'`
mem=$((("${totalmem}" / 2 / "${NRDEVICES}") * 1024))
```
@seddonm1
seddonm1 / xsd-schema.scala
Last active April 5, 2024 18:56
Makes a Spark Schema (StructType) from an input XSD file
// need to add the Apache WS XMLSchema library to spark/jars (does not have dependencies)
// https://repo1.maven.org/maven2/org/apache/ws/xmlschema/xmlschema-core/2.2.5/xmlschema-core-2.2.5.jar
import org.apache.ws.commons.schema.XmlSchemaCollection
import java.io.StringReader
import scala.collection.JavaConverters._
import org.apache.ws.commons.schema._
import org.apache.ws.commons.schema.constants.Constants
import org.apache.spark.sql.types._