Codes

Swift

by: Andrea De Martino ()

NBabel.swift
Date: July 2016
Author: Andrea De Martino (Ponza Italy, tuttologico@icloud.com)
License: GPL
 
Integration scheme: Predictor-corrector leapfrog
Compiler: Apple Swift version 2.2 (swiftlang-703.0.18.1 clang-703.0.29) (Mac Osx 10.11.5)
Operating system: Mac Osx 10.11.5 (Darwin Kernel Version 15.5.0)
Hardware: MacBook Pro Retina 13"(late 2013) CPU Intel Core i5 2,6 GHz
 
 
Input file: inputx (Plummer distribution of x equal mass particles)
Time step: constant and shared 1.e-3 N-body unit
Integration from t=0 to t=1.0
 
Performance:
N               Time            dE/E
16                0.49s         -0.0020148264613017
32                1.94s         7.3902679006644e-07
64                7.36s         2.62405884754717e-06
128              25.44s         1.97131751617966e-06
256              96.33s         -0.00554078277897679
512             386.37s         -0.122675468105415
 
Compile:
xcrun -sdk macosx swiftc nbabel.swift
or
swiftc nbabel.swift
 
Run:
./nbabel < inputFilejbedorf@sterrenpoort:~/Documents$ 
 
You can download the code here:
nbabelSwift.tgz

Show sourceSelect a file