Skip to content

Instantly share code, notes, and snippets.

View scivision's full-sized avatar
💭
I will be slow to respond.

scivision

💭
I will be slow to respond.
View GitHub Profile
@scivision
scivision / CMakeLists.txt
Last active September 27, 2024 02:56
CMake add_compile_option() SHELL: to allow spaces in options, including generator expressions. Useful for Intel oneAPI.
cmake_minimum_required(VERSION 3.15)
project(opt LANGUAGES Fortran)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
# https://www.intel.com/content/www/us/en/docs/fortran-compiler/developer-guide-reference/2024-2/warn.html
# SHELL: allows using
# * spaces in compiler options (especially important for Intel oneAPI
# * repeated option prefix, that might otherwise get deduplicated incorrectly
@scivision
scivision / CMakeLists.txt
Last active September 20, 2024 00:48
Xcode 16 Homebrew GCC 14.2 breaks with CMake
cmake_minimum_required(VERSION 3.20)
project(min LANGUAGES CXX)
message(STATUS "CMAKE_OSX_SYSROOT ${CMAKE_OSX_SYSROOT}")
foreach(i IN ITEMS OS_NAME OS_VERSION OS_RELEASE OS_PLATFORM)
cmake_host_system_information(RESULT ${i} QUERY ${i})
message(STATUS "${i}: ${${i}}")
endforeach()
@scivision
scivision / Readme.md
Last active September 12, 2024 16:00
Test simple .tar.gz archive

Just a simple tar.gz with a text file for testing

@scivision
scivision / CMakeLists.txt
Last active August 23, 2024 17:43
Show CMake detecting change in Fortran module code
cmake_minimum_required (VERSION 3.20)
project(detectChange LANGUAGES Fortran)
add_executable(main.x main.f90 moda.f90 modb.f90)
@scivision
scivision / CMakeLists.txt
Last active July 30, 2024 19:57
Benchmark CMake check*() vs. CMAKE_TRY_COMPILE_TARGET_TYPE
cmake_minimum_required(VERSION 3.23)
project(BenchmarkCheck LANGUAGES C)
include(CheckIncludeFile)
include(CheckCompilerFlag)
message(STATUS "CMake ${CMAKE_VERSION} ${CMAKE_GENERATOR} using ${CMAKE_C_COMPILER_ID} ${CMAKE_C_COMPILER_VERSION}")
set(N 5)
@scivision
scivision / .gitignore
Last active July 24, 2024 05:21
Need capital suffix ".F" or ".F90" for preprocessed Fortran source files
.DUMMY
.dummy
@scivision
scivision / Readme.md
Last active September 24, 2024 15:16
build script for LLVM & Flang-f18 Fortran compiler

Build script for Flang-f18 (flang-new) + LLVM

This is a Bash script (macOS, Linux, ...) for building Flang-f18 and LLVM from source. It is adapted from Jeff Hammond

Ninja: recommended for best build efficiency and speed.

In general, a recent GCC would work. On macOS, system AppleClang compiler can be used as well.

@scivision
scivision / CMakeLists.txt
Last active May 5, 2024 17:37
CMake MPI TEST_LAUNCHER
cmake_minimum_required(VERSION 3.15)
project(mpitest LANGUAGES Fortran)
enable_testing()
find_package(MPI COMPONENTS Fortran REQUIRED)
include(TestMPILauncher.cmake)
@scivision
scivision / CMakeLists.txt
Created February 12, 2024 16:37
benchmark CMake ExternalProject/FetchContent URL vs GIT_REPOSITORY
# benchmark download of URL vs. Git
# benchmark with CMake 3.28.2 on Windows with gigabit internet connection.
#
# Python 3.12.2 source
# 7 seconds: URL archive 27583112 bytes
# 84 seconds GIT_SHALLOW=true
# 132 seconds GIT_SHALLOW=false
#
# CMake 3.28.3 source:
@scivision
scivision / listeners.ps1
Created February 7, 2024 17:04
PowerShell list ports that programs are listening on
# copied from https://superuser.com/a/1808022
$procs = Get-Process
$ports = netstat -ano
$ports[4..$ports.length] |
# First column comes back empty, so we set to "ProcessName" as a placeholder for later
ConvertFrom-String -PropertyNames ProcessName,Proto,Local,Remote,State,PID |
where State -eq 'LISTENING' |
foreach {
$_.ProcessName = ($procs | where ID -eq $_.PID).ProcessName