Skip to content

Instantly share code, notes, and snippets.

@moble
moble / ComparingIntegrationMethods.ipynb
Last active February 23, 2022 16:30
Notebooks related to 'The integration of angular velocity' https://arxiv.org/abs/1604.08139
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@moble
moble / rpxmb.ipynb
Last active September 9, 2021 16:29
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@moble
moble / README.md
Last active December 13, 2023 14:22
Speed up execution of `@everywhere` in julia

As described in detail here, julia can take really excessive amounts of time to execute the first @everywhere statement on many processes — around 1 hour for thousands of processes — even if the actual code being executed everywhere is trivial. Basically, the Distributed functions need to be precompiled to make this happen quickly.

This gist provides a simple way to do so — at least on Slurm clusters (though the same principles should apply elsewhere). Just submit precompile.jl as a batch job (adjusting the SBATCH directives as needed), and it should create a sysimage that you can use to run future batch jobs. Check end of the log of the Slurm job to see exactly how to use the sysimage.

Note that both the original julia process and all processes created with addprocs should use the --sysimage=/path/to/sys_everywhere.so argument. Doing so reduces the time taken to execute the first @everywhere sta

@moble
moble / README.md
Last active August 17, 2021 03:34
Speed up execution of `@everywhere` in julia
NOTE: A somewhat streamlined version of this approach can be found in this other gist, which involves only one simple script. You could still use the timing files from this gist if you want to check the details.

As described in detail here, julia can take really excessive amounts of time to execute the first @everywhere statement on many processes — around 1 hour for thousands of processes — even if the actual code being executed everywhere is trivial. Basically, the Distributed functions need to be precompiled to make this happen quickly.

This gist provides a simple way to do so — at least on Slurm clusters (though the same principles should apply elsewhere). The key file is organizer.jl; just submit it as a batch job (adjusting the SBATCH directives as needed), and it should create a sysimage that you can use to run futur

@moble
moble / memory.ipynb
Last active December 18, 2020 15:13
Notebook demonstrating the use of sxs memory functions
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@moble
moble / unique_gene_id.py
Last active October 11, 2023 02:33
Ensure GTF-format files have `gene_id` fields unique to each `gene_name` or `transcript_id`
#!/usr/bin/env python
# Copyright (c) 2020, Michael Boyle
#
# MIT License
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
@moble
moble / show_dimensions.tex
Last active September 4, 2020 16:44
Get latex to tell you its sizes, then use those sizes in matplotlib to create plots that will fit perfectly in your latex file
% Anywhere you want to see the dimensions latex is using, just place
% this command in the tex file itself, run latex, and look for these
% items in the compilation output. For example, to see these numbers
% as latex uses them within the text, just put this command in the
% main text. To see them in a figure caption, just put this command
% where you write the caption text. Note that the standard
% points-per-inch ratio is 72.27.
\makeatletter
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@moble
moble / CliffordCompression.ipynb
Created October 17, 2018 18:20
Comparison of npz and h5 compression
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.