Skip to content

Instantly share code, notes, and snippets.

Configuring the R BatchJobs package for Torque batch queues
https://www.r-bloggers.com/configuring-the-r-batchjobs-package-for-torque-batch-queues/
Rstudio server: start R sessions as a job on cluster ?
Unfortunately, we don't currently have a feature that does this
stackoverflow mentioned the following on how to run Rstudio on a computation node of a remote linux cluster
http://stackoverflow.com/questions/23639125/how-to-run-rstudio-on-a-computation-node-of-a-remote-linux-cluster
What is often done is use Rstudio for development and then wrap everything in a self-contained R script to submit to the cluster with something like
@caot
caot / compile and run example_chbmv.c
Created September 30, 2016 14:34
clBLAS 2.11 example_chbmv.c
/*
example_chbmv.c is from http://clmathlibraries.github.io/clBLAS/example_chbmv_8c-example.html
$ gcc -Wall -I/share/apps/clblas-2.10/include -L/share/apps/clblas-2.10/lib64 -o example_chbmv example_chbmv.c -lclBLAS
$ ./example_chbmv
Result:
( 1.00, 0.00 )
( 2.00, 0.00 )
( 3.00, 0.00 )
( 4.00, 0.00 )
@caot
caot / clBLAS 2.11 example_chemm.cpp
Created September 30, 2016 14:54
compile and run example_chemm.cpp
/*
example_chemm.cpp is from http://clmathlibraries.github.io/clBLAS/example_chemm_8cpp-example.html
$ gcc -Wall -I/share/apps/clblas-2.10/include -I/share/apps/cuda-7.5/include -L/share/apps/clblas-2.10/lib64 -o example_chemm example_chemm.cpp -lclBLAS
$ ./example_chemm
Result:
< 41430.00, 46230.00 > <-39740.00, 87400.00 > < 48960.00, 48400.00 >
< 41360.00, 54760.00 > <-48340.00, 90520.00 > < 32620.00, 53220.00 >
< 28830.00, 79370.00 > <-67980.00, 77040.00 > < 13400.00, 81160.00 >
<-24980.00, 90100.00 > <-114700.00, -43780.00> <-67560.00, 93200.00 >
@caot
caot / CLBlast 0.6.0 sgemm.c
Created September 30, 2016 16:21
compile and run sgemm.c
/*
sgemm.c is from https://github.com/CNugteren/CLBlast/issues/51
$ g++ -std=c++11 sgemm.c -fdiagnostics-color=always -I/share/apps/clblast-0.6.0/include -I/share/apps/cuda-7.5/include -L/share/apps/clblast-0.6.0/lib -lOpenCL -lclblast -o sgemm
$ ./sgemm
1 2
3 4
5 6
1 2 3
4 5 6
@caot
caot / CLBlast 0.6.0 sgemm.cpp
Created September 30, 2016 16:28
compile and run sgemm.cpp
/*
sgemm.cpp is from https://github.com/CNugteren/CLBlast/blob/master/samples/sgemm.cpp
$ g++ -std=c++11 sgemm.cpp -fdiagnostics-color=always -I/share/apps/clblast-0.6.0/include -I/share/apps/cuda-7.5/include -I/share/apps/cuda-7.5/include/CL -L/share/apps/clblast-0.6.0/lib -lOpenCL -lclblast -o sgemm
$ ./sgemm
Completed SGEMM in 30.277 ms with status 0
[tangc@compute-3-3 clBlast_examples]$
*/
// =================================================================================================
@caot
caot / JOCLBlastSample.java
Created September 30, 2016 18:41
JOCLBlast Example
/*
JOCLBlastSample.java is from https://forum.byte-welt.net/archive/index.php/t-18180.html
$ cat output
CL_DEVICE_NAME: Tesla K40m
A:
11.0 12.0 13.0 14.0 15.0
21.0 22.0 23.0 24.0 25.0
31.0 32.0 33.0 34.0 35.0
41.0 42.0 43.0 44.0 45.0
command = "ls /etc | grep release";
String[] cmd = { "/bin/sh", "-c", command };
ProcessBuilder pb = new ProcessBuilder(cmd);
pb.redirectOutput(Redirect.INHERIT);
pb.redirectError(Redirect.INHERIT);
Process p = pb.start();
p.waitFor();
@caot
caot / run commands over SSH on many servers.sh
Last active November 7, 2017 03:50
run commands over SSH on many servers / clusters
#!/bin/bash
# ref http://unix.stackexchange.com/questions/19008/automatically-run-commands-over-ssh-on-many-servers
echo $(date)
echo $@
tmp_dir_prefix=pssh-to-be-deleted-Cu8vihiWFhATbsGlSrUO
rm -r /tmp/${tmp_dir_prefix}.*
@caot
caot / iOS-UploadImage.h
Created October 31, 2016 17:54 — forked from mombrea/iOS-UploadImage.h
example of a multi-part form post in objective-c
NSMutableURLRequest *request = [[NSMutableURLRequest alloc] initWithURL:[NSURL URLWithString:@"REST URL PATH"]];
NSData *imageData = UIImageJPEGRepresentation(image, 1.0);
[request setCachePolicy:NSURLRequestReloadIgnoringLocalCacheData];
[request setHTTPShouldHandleCookies:NO];
[request setTimeoutInterval:60];
[request setHTTPMethod:@"POST"];
NSString *boundary = @"unique-consistent-string";
/*
https://www.wiki.ed.ac.uk/display/ecdfwiki/cudaOpenMP.cu
module load cuda/7.5
nvcc -Xcompiler -fopenmp -lgomp -o cudaOpenMP.out cudaOpenMP.cu
./cudaOpenMP.out
*/
#include <omp.h>