Skip to content

Instantly share code, notes, and snippets.

View greyltc's full-sized avatar
💭
I may be slow to respond.

M. Greyson Christoforo greyltc

💭
I may be slow to respond.
View GitHub Profile
@greyltc
greyltc / search-for-primes.py
Created February 5, 2021 17:38
multi process version of the prime number counter from https://www.youtube.com/watch?v=hGyJTcdfR1E
import multiprocessing as mp
import time
#max number to look up to
max_number = 10000
#four processes per cpu
num_processes = mp.cpu_count() * 4
def chunks(seq, chunks):
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Fortran namelist parser. Converts nameslists to python dictionaries.
Should be fairly robust. Cannot be used for verifying fortran namelists as it
is rather forgiving.
Error messages during parsing are kind of messy right now.