Skip to content

Instantly share code, notes, and snippets.

@gavinb
gavinb / nvcc_warnings.md
Last active February 21, 2024 00:39
How to disable specific warnings with nvcc

We were seeing the following unexpected warnings in our builds:

C:/BuildAgent/work/19dd4d6ddfbe72aa/SecretProject/vcpkg_installed/x64-windows/include\fmt/format.h(771): warning : base class dllexport/dllimport specification differs from that of the derived class
C:/BuildAgent/work/19dd4d6ddfbe72aa/SecretProject/vcpkg_installed/x64-windows/include\fmt/format.h(3268): warning : base class dllexport/dllimport specification differs from that of the derived class

We use spdlog and fmt all over the place and weren't seeing these warnings elsewhere. Strangely there were not the usual error/warning codes that the compiler emits.
Then I noticed why - these diagnostics were preceded by the module name:

SomeFilter.cu
@gavinb
gavinb / controller.i
Created November 4, 2020 08:17
SWIG example of defining C# property
/*
swig -csharp -c++ -namespace MyControl -outdir ..\gen MyControl.i
*/
%module MyControl
%include <attribute.i>
%{
/* Includes the header in the wrapper code */
@gavinb
gavinb / Build_ITK_app_with_vcpkg.md
Last active October 19, 2020 06:56
How to use ITK with vcpkg

There is a package for the Insight Toolkit (ITK) v5.1 in the vcpkg tool's ports collection. It installs itself into a folder called ITK-5.1 under the triplet's include folder. However, if you are using the Visual Studio integration (which is very convenient) then this will not work. The headers in ITK do not have a prefix, so they expect to be in the root of a specified include path. The solution is to add it manually, thus:

  • go into the Project Properties' dialog
  • go to the 'C/C++ > General' page
  • edit the 'Additional Include Directories' setting
  • add the following entries to the paths:
@gavinb
gavinb / Anaconda_Python_OpenCV_fail.md
Last active June 22, 2020 06:03
Solve problem installing OpenCV under Anaconda Python

Using Anaconda's distribution of Python for SciPy on Windows 10

Trying to install OpenCV support according to the official page:

https://anaconda.org/conda-forge/opencv

conda install -c conda-forge opencv

fails with the following error:

The Visual Studio compiler generates and modifies many large project-wide binary files during compilation, so normally you can only have one instance of cl running per project. If you use the awesome Ninja tool, it will happily run many instances in parallel on multicore systems. When run this way however, MSVC will throw errors like this:

fatal error C1041: cannot open program database 'sample_project_pathname.pdb';
if multiple CL.EXE write to the same .PDB file, please use /FS
@gavinb
gavinb / cuda_device_link_error.md
Last active April 12, 2024 14:54
CUDA link error with CMake
@gavinb
gavinb / gist:8afca1d2335f3c1939cb23c475fe5429
Created October 31, 2016 14:56
Cargo build from acrichton/bad of rust-rosetta showing rust-openssl problem
This file has been truncated, but you can view the full file.
DEBUG:cargo::build: executing; cmd=cargo-build; args=["/Users/abc/src/cargo/target/debug/cargo", "build"]
TRACE:cargo::ops::cargo_read_manifest: read_package; path=/Users/abc/src/rust-rosetta/Cargo.toml; source-id=file:///Users/abc/src/rust-rosetta
DEBUG:cargo::core::workspace: find_root - is root /Users/abc/src/rust-rosetta/Cargo.toml
DEBUG:cargo::core::workspace: find_members - /Users/abc/src/rust-rosetta/tasks/100-doors/Cargo.toml
TRACE:cargo::ops::cargo_read_manifest: read_package; path=/Users/abc/src/rust-rosetta/tasks/100-doors/Cargo.toml; source-id=file:///Users/abc/src/rust-rosetta/tasks/100-doors
DEBUG:cargo::core::workspace: find_members - /Users/abc/src/rust-rosetta/tasks/2048/Cargo.toml
TRACE:cargo::ops::cargo_read_manifest: read_package; path=/Users/abc/src/rust-rosetta/tasks/2048/Cargo.toml; source-id=file:///Users/abc/src/rust-rosetta/tasks/2048
DEBUG:cargo::core::workspace: find_members - /Users/abc/src/rust-rosetta/tasks/24-game/Cargo.toml
TRACE:cargo::ops::cargo_read_manifest: read_package;
@gavinb
gavinb / gist:0c9874b66cae5779424a228b6c9b4dac
Created October 31, 2016 00:06
Trace of `cargo build` showing update after successful build
This file has been truncated, but you can view the full file.
DEBUG:cargo::build: executing; cmd=cargo-build; args=["/Users/abc/.multirust/toolchains/nightly-x86_64-apple-darwin/bin/cargo", "build"]
TRACE:cargo::ops::cargo_read_manifest: read_package; path=/Users/abc/src/rust-rosetta/Cargo.toml; source-id=file:///Users/abc/src/rust-rosetta
DEBUG:cargo::core::workspace: find_root - is root /Users/abc/src/rust-rosetta/Cargo.toml
DEBUG:cargo::core::workspace: find_members - /Users/abc/src/rust-rosetta/tasks/100-doors/Cargo.toml
TRACE:cargo::ops::cargo_read_manifest: read_package; path=/Users/abc/src/rust-rosetta/tasks/100-doors/Cargo.toml; source-id=file:///Users/abc/src/rust-rosetta/tasks/100-doors
DEBUG:cargo::core::workspace: find_members - /Users/abc/src/rust-rosetta/tasks/2048/Cargo.toml
TRACE:cargo::ops::cargo_read_manifest: read_package; path=/Users/abc/src/rust-rosetta/tasks/2048/Cargo.toml; source-id=file:///Users/abc/src/rust-rosetta/tasks/2048
DEBUG:cargo::core::workspace: find_members - /Users/abc/src/rust-rosetta/tasks/24-game/Cargo.toml
TRACE:cargo::ops::carg
@gavinb
gavinb / gist:9924137
Last active August 29, 2015 13:57
Trying template types
use std::num::{Zero};
use std::vec::Vec;
use std::mem::size_of;
pub struct Image<T> {
width: uint,
height: uint,
// ...
buffer: Vec<T>,
@gavinb
gavinb / mrb.rs
Created March 26, 2014 05:37
Trying to share channels
extern crate native;
use std::comm::{Sender, Receiver, TryRecvResult, Data, channel};
struct Master<'a> {
chan_wc_to_engine: Sender<uint>,
chan_wc_from_engine: Receiver<uint>,
chan_engine_to_wc: Sender<uint>,
chan_engine_from_wc: Receiver<uint>,