Skip to content

Instantly share code, notes, and snippets.

Development of a mini C++ MPI3 wrapper

Step 2 - Communicator

Add a communicator class. For now it contains a rank function to get the MPI rank. Eventually it will contain most of the communication functions.

The raw MPI_Comm value is stored internally to the class.

@markdewing
markdewing / comd.py
Created December 8, 2015 23:17
Visualization of molecular dynamics using VisPy
from __future__ import print_function, division
import simflat
import initatoms
import time
import constants
import argparse
from multiprocessing import Process, Queue
from Queue import Empty
import collections
@markdewing
markdewing / comd.py
Created November 13, 2015 16:22
More optimization of CoMD for Numba (using feedback from a profiler)
from __future__ import print_function, division
import simflat
import initatoms
import time
import constants
import argparse
import numba
# Translation of CoMD to Python
@markdewing
markdewing / linkcell.py
Created October 2, 2015 16:36
Numba-optimzed version of CoMD cell version.
from __future__ import print_function, division
import numpy as np
import math
import numba
def initLinkCells(sim, box_size):
gridSize = np.array([int(b/sim.pot.cutoff) for b in box_size], dtype=np.int)
boxSize = box_size*1.0/gridSize
@markdewing
markdewing / comd.py
Created October 2, 2015 16:34
Cython code for CoMD cell method
import pyximport; pyximport.install()
import simflat
import initatoms
import time
import constants
import argparse
# Translation of CoMD to Python
@markdewing
markdewing / comd.jl
Created October 2, 2015 16:26
Optimized Julia code for CoMD cell method variant
include("initAtoms.jl")
include("simflat.jl")
include("ljforce.jl")
using ArgParse
# Translation of CoMD to Julia
function initValidate(sim)
@markdewing
markdewing / ljforce.jl
Created September 18, 2015 03:23
Julia version of inner force loop for the nsquared version of CoMD, after removing some extraneous allocations.
include("constants.jl")
type LJ_Pot
sigma::Float
epsilon::Float
mass::Float
lat::Float
lattice_type::String
cutoff::Float
name::String
@markdewing
markdewing / ljforce.py
Created September 18, 2015 02:50
Numba version of inner force loop for the nsquared version of CoMD in Python
import constants
import numba
class LJ_Pot(object):
def __init__(self):
self.sigma = 2.315
self.epsilon = 0.167
self.mass = 63.55 * constants.amuToInternalMass
self.lat = 3.615
self.lattice_type = 'FCC'
@markdewing
markdewing / ljforce.pyx
Created September 18, 2015 02:44
Cython version of inner force loop for the nsquared version of CoMD in Python.
import constants
import cython
cimport numpy as np
class LJ_Pot(object):
def __init__(self):
self.sigma = 2.315
self.epsilon = 0.167
self.mass = 63.55 * constants.amuToInternalMass
@markdewing
markdewing / force.py
Created May 15, 2014 07:30
Symbolic force computation
# Compute force on a particle with a pair potential
# Uses Lennard-Jones potential
import sympy
# Assigment looks like a relational operator, but probably shouldn't be
from sympy.core.relational import Assignment
import sympy.printing