Skip to content

Instantly share code, notes, and snippets.

View jefflarkin's full-sized avatar
🙃
Happy

Jeff Larkin jefflarkin

🙃
Happy
View GitHub Profile
@jefflarkin
jefflarkin / nvtx.F90
Last active February 21, 2023 16:57
Simple Fortran bindings to a subset of the NVTX library.
! Fortran bindings for a small subset of the NVIDIA Tools Extensions library
module nvtx
use iso_c_binding
public :: nvtxrangepusha, nvtxrangepop
public :: nvtxrangepushaargb
interface
! Annotate the timeline with a message
! Parameters:
! * string : the message in a string format
subroutine nvtxrangepusha(string) bind(C, name="nvtxRangePushA")
@jefflarkin
jefflarkin / app.js
Created January 16, 2014 03:01
Error I'mm seeing from HAPI hello world example.
var Hapi = require('hapi');
var server = Hapi.createServer(process.env.IP,parseInt(process.env.PORT));
// Define the route
var hello = {
handler: function (request) {
request.reply({ greeting: 'hello world' });
}
};
@jefflarkin
jefflarkin / gist:8293839
Created January 7, 2014 02:36
Example of using Charlieplexing [http://en.wikipedia.org/wiki/Charlieplexing] to control 6 LEDs with an arduino.
/** Charlieplexing 6 LEDs with Arduino Uno **/
/** Jeff Larkin [http://github.com/jefflarkin] **/
/*
* Wiring Diagram:
*
* pin 2 ===== led0+, led1- ===== led4+, led5-
* pin 4 ===== led1+, led0- ===== led2+, led3-
* pin 6 ===== led3+, led2- ===== led5+, led4-
*
*/
@jefflarkin
jefflarkin / nvprof.sh
Last active January 30, 2017 01:32
This script allows for generating nvprof output files based on the hostname of a Cray XK7 compute node.
#!/bin/bash
# USAGE: Add between aprun options and executable
# For Example: aprun -n 16 -N 1 ./foo arg1 arg2
# Becomes: aprun -n 16 -N 1 ./nvprof.sh ./foo arg1 arg2
# Give each *node* a separate file
LOG=profile_$(hostname).nvp
# Stripe each profile file by 1 to share the load on large runs
lfs setstripe -c 1 $LOG
@jefflarkin
jefflarkin / cudaCheckError.c
Created April 15, 2013 20:18
A simple macro for checking errors after CUDA library calls.
//Macro for checking cuda errors following a cuda launch or api call
#define cudaCheckError() { \
cudaError_t e=cudaGetLastError(); \
if(e!=cudaSuccess) { \
printf("Cuda failure %s:%d: '%s'\n",__FILE__,__LINE__,cudaGetErrorString(e)); \
exit(0); \
} \
}
@jefflarkin
jefflarkin / cudaCheckError.c
Created April 15, 2013 20:18
A simple macro for checking errors after CUDA library calls.
//Macro for checking cuda errors following a cuda launch or api call
#define cudaCheckError() { \
cudaError_t e=cudaGetLastError(); \
if(e!=cudaSuccess) { \
printf("Cuda failure %s:%d: '%s'\n",__FILE__,__LINE__,cudaGetErrorString(e)); \
exit(0); \
} \
}
@jefflarkin
jefflarkin / profile.sh
Last active December 16, 2015 01:39
Quick trick for getting different cuda command-line profiler log files per node on a Cray XK7.
#!/bin/bash
# USAGE: Add between aprun options and executable
# For Example: aprun -n 16 -N 1 ./foo arg1 arg2
# Becomes: aprun -n 16 -N 1 ./profile.sh ./foo arg1 arg2
# Enable command-line profiler
export COMPUTE_PROFILE=1
# Set output to CSV (optional)
export COMPUTE_PROFILE_CSV=1
program mm
use omp_lib
integer(8), parameter :: N = 4096
integer(8) :: i,j,k,tmp6,tmp2
real(8), dimension(N,N) :: A, B, C
real(8) :: tmp, chk, t0, t1, t2, t3
t0 = omp_get_wtime()
!$acc data create(A,B,C)
!$acc kernels
@jefflarkin
jefflarkin / 1test.F90
Created October 25, 2012 14:42
Testing Derived Types with OpenACC
module dtmod
implicit none
private
integer, public, parameter :: N = 64
type, public :: mytype
sequence
real(8) :: a(N,N)
real(8) :: b(N,N)
end type mytype
end module
@jefflarkin
jefflarkin / charactersheet.xml
Created September 21, 2011 01:14
LOTRO Data API Results
<?xml version="1.0" encoding="UTF-8" ?>
- <apiresponse>
- <character name="Mathrid" world="Crickhollow" monster="0" race="Race of Man" race_id="23" class="Champion" class_id="172" level="30" origin="Dale" origin_id="16">
- <vocation name="Woodsman" vocation_id="1879062814">
- <professions>
<profession name="Woodworker" profession_id="1879055941" proficiency="2" mastery="1" icon_profession="http://lorebook.lotro.com/icon.php?type=profession&id=1879055941" />
<profession name="Farmer" profession_id="1879062816" proficiency="0" mastery="0" icon_profession="http://lorebook.lotro.com/icon.php?type=profession&id=1879062816" />
<profession name="Forester" profession_id="1879062817" proficiency="2" mastery="2" icon_profession="http://lorebook.lotro.com/icon.php?type=profession&id=1879062817" />
</professions>
</vocation>