Skip to content

Instantly share code, notes, and snippets.

View philipturner's full-sized avatar
🏠
Working from home

Philip Turner philipturner

🏠
Working from home
View GitHub Profile
@philipturner
philipturner / ElmerMac3.sh
Last active July 21, 2025 13:00
The optimal compile script for Elmer on macOS
# Invoke this script from a terminal where pwd = ElmerCSC/elmerfem/build.
#
# My file hierarchy:
# ~/Documents
# Elmer
# elmer
# bin
# lib
# share
# elmerfem
@philipturner
philipturner / ElmerMac2.md
Last active July 16, 2025 15:26
Reproducing the original successful compilation, with options closer to the main repo's GitHub workflow
(base) philipturner@macbookpro ~ % cmake --system-information
Avoid ctest truncation of output: CTEST_FULL_OUTPUT
========================================================
=== MAIN VARIABLES
========================================================
CMAKE_STATIC_LIBRARY_PREFIX == "lib"
CMAKE_STATIC_LIBRARY_SUFFIX == ".a"
CMAKE_SHARED_LIBRARY_PREFIX == "lib"
CMAKE_SHARED_LIBRARY_SUFFIX == ".dylib"
CMAKE_SHARED_MODULE_PREFIX == "lib"
@philipturner
philipturner / ElmerMac.md
Last active July 16, 2025 14:57
Trying even harder to get Elmer to work on macOS

New suggestions:

Building ElmerFEM for Apple Silicon works in CI. E.g., https://github.com/ElmerCSC/elmerfem/actions/runs/16269780344/job/45934148818

If I understand the error message from ranlib correctly, it says that some of the object files being archived (e.g., biniomod.f90.o) are built for Apple Silicon (16777228). But other objects that had been added to that static library previously had been built for Intel architecture (16777223).

Not sure why that is. Are you building from a fresh build tree? Are you mixing compilers (e.g., Fortran, C, C++) that are building for different targets? Are other object files that you installed for the Intel architecture when you actually try to build for Apple Silicon?
I'm not a macOS user myself. But maybe try re-installing XCode and make sure that you are getting the correct packages and compilers (from MacPorts?).
Don't try to mix tools for Apple Silicon with tools for Intel architecture.

Sequential Throughput Bottlenecks of APM

Parallelism doesn't beat Amdahl's Law. This is the reason simulations requiring a supercomputer never make their way into laptop CAD applications.

Bootstrapping is a sequence of phases, where you use the speed & parallelism of the current phase to fabricate systems that eliminate the current biggest bottleneck.

Objectives

We need to perform sequential chemical steps:

  • Fast (>1 Hz frequency)
@philipturner
philipturner / main.swift
Created June 9, 2025 12:35
Important notes about run loop structure
// Next steps:
// - Understand the structure of the run loop better. [DONE]
// - Write the SwapChain utility for Windows.
// - Reproduce the 1st 3DGEP tutorial using empty render passes.
// - Reproduce the StackOverflow comment (https://stackoverflow.com/a/78501260)
// about rendering with entirely compute commands.
import MolecularRenderer
#if os(macOS)
@philipturner
philipturner / VectorAddition.swift
Created June 4, 2025 21:17
Fifth set of files saved for easy reference, while cleaning up an iteration of the Windows port of Molecular Renderer
#if os(Windows)
import MolecularRenderer
/// Utility code for setting up a vector addition test.
class VectorAddition {
let inputBuffer0: Buffer
let inputBuffer1: Buffer
let nativeBuffer0: Buffer
let nativeBuffer1: Buffer
@philipturner
philipturner / main.swift
Created May 27, 2025 20:21
Fourth set of files saved for easy reference, while cleaning up an iteration of the Windows port of Molecular Renderer
// Next steps:
// - Access the GPU.
// - Modify it to get Metal rendering. [DONE]
// - Clean up and simplify the code as much as possible. [DONE]
// - Get timestamps synchronizing properly (moving rainbow banner
// scene). [DONE]
// - Repeat the same process with COM / D3D12 on Windows.
// - Get some general experience with C++ DirectX sample code.
// - Modify the files one-by-one to support Windows.
@philipturner
philipturner / main.swift
Created May 23, 2025 17:49
Third set of files saved for easy reference, while cleaning up an iteration of the Windows port of Molecular Renderer
// Next steps:
// - Access the GPU.
// - Modify it to get Metal rendering. [DONE]
// - Clean up and simplify the code as much as possible. [DONE]
// - Get timestamps synchronizing properly (moving rainbow banner
// scene). [DONE]
// - Repeat the same process with COM / D3D12 on Windows.
// - Get some general experience with C++ DirectX sample code.
// - Modify the files one-by-one to support Windows.
@philipturner
philipturner / SiliconCarbide.md
Last active May 24, 2025 14:53
First attempt at a matter compiler, mapping an arbitrary crystalline product to a sequence of tips

Silicon Carbide

Define the goals of this project:

  • Formalize the SiC layer initiation and lattice extension.
  • Create a method to compile matter into a sequence of tips.
  • As a result, I can quantify the slowness from tip randomization.

End goal is to exactly know the building speed of SiC vs. amorphous carbon.