Skip to content

Instantly share code, notes, and snippets.

@fwyzard
fwyzard / test.cu
Last active November 23, 2021 14:04
Test program to check what CUDA operations can be performed on a device different than the current one
#include <cuda_runtime.h>
#include "cudaCheck.h"
int main(void) {
// 3D buffer layout
constexpr size_t pitch = 32;
constexpr size_t width = 20;
static_assert(width <= pitch, "The 3D buffer `width` cannot be larger than the `pitch`.");
constexpr size_t height = 8;
constexpr size_t slices = 4;
@fwyzard
fwyzard / build.sh
Last active February 25, 2020 16:42
Build the Intel or Codeplay LLVM branches
#! /bin/bash -e
CUDA_BASE=/usr/local/cuda
SYCL_BASE=$PWD
INSTALL_PATH=/opt/llvm
mkdir -p $SYCL_BASE/llvm
cd $SYCL_BASE/llvm
if ! [ -d .git ]; then
@fwyzard
fwyzard / install CUDA.md
Last active October 16, 2019 15:34
Install CUDA and repacke the NVIDIA kernel modules

RHEL 7

download the CUDA RPMs:

ssh -f -N -o ControlMaster=auto -D 1080 cmsusr.cms 
export ALL_PROXY=socks5://localhost:1080
curl http://developer.download.nvidia.com/compute/cuda/10.1/Prod/local_installers/cuda-repo-rhel7-10-1-local-10.1.243-418.87.00-1.0-1.x86_64.rpm -o cuda-repo-rhel7-10-1-local-10.1.243-418.87.00-1.0-1.x86_64.rpm

unpack the individual RPMs under /var/cuda-repo-10-1-local-10.1.243-418.87.00/:

@fwyzard
fwyzard / build UCX and Open MPI.md
Last active August 22, 2019 16:06
Build UCX and Open MPI for integration in CMSSW

create local direcotries

mkdir -p $CMSSW_BASE/build
mkdir -p $CMSSW_BASE/local

zlib

exported environment

@fwyzard
fwyzard / xavier-lxc-centos7.md
Last active June 17, 2023 08:13
Install CentOS 7 in an LXC/LXD container on an NVIDIA Xavier

Install and configure LXD

Install LXD

sudo snap install lxd

Perform the initial configuration

sudo lxd init
@fwyzard
fwyzard / optimus.md
Last active July 3, 2021 15:51
Configure Optimus for Ubuntu 18.10

Configure the system to use the Intel driver

Disable GPU Manager

GPU Manager will overwrite the X configuration at each reboot, so the first step is to disable it.

According to various posts it can be disabled adding nogpumanager to the boot options e.g. in GRUB. Edit /etc/default/grub and add nogpumanager to the GRUB_CMDLINE_LINUX option.

For example, if /etc/default/grub had

@fwyzard
fwyzard / test.cu
Last active March 16, 2018 15:28
Simple file showing how __host__ __device_ function interact
#include <cstdio>
#include <cuda.h>
__host__ __device__
void where() {
#if defined __CUDA_ARCH__
printf(" on the device");
#else
printf(" on the host");
#endif
@fwyzard
fwyzard / DQMGlobalEDAnalyzer from legacy.md
Last active January 18, 2018 16:15
How to migrate a legacy DQM edm::EDAnalyzer to a DQMGlobalEDAnalyzer

How to migrate a legacy DQM edm::EDAnalyzer to a DQMGlobalEDAnalyzer

Given the diversity and possible complexity of some legacy DQM modules, this guide will likely not address all the required changes. Please consider it more as a set of suggestions than as a strict list of steps to be follwed; for any more information please refer to the migration guide to the DQMAnalyzer module, or ask the DQM Core team.

A DQMGlobalEDAnalyzer module is a specialisation of an edm::global::EDanalyzer module:

  • it is a global module rather than a legacy module: there is only one copy of it, no matter how many threads or streams the job is configured to use, but it can "see" multiple events being processed at the same time; the advantage is that multiple events can be analised concurrently; on the other hand the module's internal state (the data members) are not allowed to change during the analyze() (or dqmAnalyze()) method, unless in a concurrency-safe way. See [FWMultithreadedFrameworkGlobalModuleInt
@fwyzard
fwyzard / DQMGlobalEDAnalyzer.md
Last active January 18, 2018 16:16
How to migrate a DQMEDanalyzer to a DQMGlobalEDAnalyzer

How to migrate a DQMEDanalyzer to a DQMGlobalEDAnalyzer

A DQMGlobalEDAnalyzer module is similar to a DQMEDanalyzer, with few differences:

  • it is a global module rather than a stream module: there is only one copy of it, no matter how many threads or streams the job is configured to use, and it will "see" all events being processed; the advantage is a significant reduction in memory usage as the number of streams increases; on the other hand this means that its internal state (the data members) are not allowed to change during the analyze() (or dqmAnalyze()) method, unless in a concurrency-safe way. See FWMultithreadedFrameworkGlobalModuleInterface for the details.
  • it uses ConcurrentMonitorElements rather than MonitorElements to expose a concurrecy-safe interface to the DQMStore; these objects are also "global": the DQMStore holds a single copy of the histograms, and there is not me
@fwyzard
fwyzard / framework.md
Last active November 30, 2017 15:41
Simplified overview of the processing flow for the CMSSW EDM framework