• Stars
    star
    121
  • Rank 292,252 (Top 6 %)
  • Language
    Swift
  • License
    MIT License
  • Created over 8 years ago
  • Updated over 4 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

iOS Swift framework for parallel processing

Fog Machine Framework

viewshed on three phones

Fog Machine is an iOS Swift framework for parallel processing. Solve hard problems fast with the Fog Machine framework.

The Fog Machine framework is a research and development effort to harness the computing power of multiple, locally connected iOS devices. By using a mesh-network of mobile devices, parallel processing techniques allows Fog Machine to analyze data and answer complex questions quickly and efficiently. Parallel processing over mesh-networks reduces the overall time to solve problems by taking advantage of shared resources (processors, memory, etc.). The communication relies on a Wi-Fi or Bluetooth chipset and is built on Apple's Multipeer Connectivity framework.

There are two demo apps provided to showcase the Fog Machine framework:

  1. The FogStringSearch app is a simple text search that uses the Knuth–Morris–Pratt string search algorithm to find a search term within a given text.
  2. The FogViewshed app calculates the viewshed of a position. A viewshed is the geographical area that is visible from a location. It includes all surrounding points in line-of-sight with the location and excludes points that are beyond the horizon or obstructed by terrain and other features. The viewshed app demonstrates the true power and flexibility of the Fog Machine framework. 1. The FogViewshed app will also provide a 2D and 3D rendering of the digital elevation model (DEM) data. The 3D rendering will overlay the last generated DEM or viewshed for the position.

dem2D on phone dem3D on phone viewshed on phone viewshedDem3D gif on phone

Fog Machine was developed at the National Geospatial-Intelligence Agency (NGA) in collaboration with BIT Systems. The government has "unlimited rights" and is releasing this software to increase the impact of government investments by providing developers with the opportunity to take things in new directions. The software use, modification, and distribution rights are stipulated within the MIT license.

Installation with CocoaPods

CocoaPods is a dependency manager for Objective-C and Swift. You can install CocoaPods with the following command:

$ gem install cocoapods

Podfile

To integrate Fog Machine into your Xcode project using CocoaPods, specify it in your Podfile:

source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '9.0'

target 'TargetName' do
pod 'FogMachine', '~> 4.0.4'
end

Then, run the following command:

$ pod install

Build from source

Pull down the latest source:

$ git clone [email protected]:ngageoint/fog-machine.git

Clean the pod cache and download the dependencies that Fog Machine needs from CocoaPods:

$ pod cache clean --all
$ pod install

Launch xcode and smile, you're all done:

$ open FogMachine.xcworkspace

Usage

The Fog Machine framework provides a simple lifecycle for your app to use. After extending FMTool, you can immediately start running your tasks in parallel.

// What do I need help with?  How about saying hello?
public class HelloWorldTool : FMTool {
  public override func createWork(node:FMNode, nodeNumber:UInt, numberOfNodes:UInt) -> HelloWorldWork {
    return HelloWorldWork(nodeNumber: nodeNumber)
  }

  public override func processWork(node:FMNode, fromNode:FMNode, work: FMWork) -> HelloWorldResult {
    let helloWorldWork:HelloWorldWork = work as! HelloWorldWork
    print("Hello world, this is node \(helloWorldWork.nodeNumber).")
    return HelloWorldResult(didSayHello: true)
  }

  public override func mergeResults(node:FMNode, nodeToResult: [FMNode:FMResult]) -> Void {
    var totalNumberOfHellos:Int = 0
    for (n, result) in nodeToResult {
      let helloWorldResult = result as! HelloWorldResult
      if(helloWorldResult.didSayHello) {
        totalNumberOfHellos += 1
      }
    }
    print("Said hello \(totalNumberOfHellos) times.  It's a good day. :)")
  }
}


// Tell Fog Machine what we need help with
FogMachine.fogMachineInstance.setTool(HelloWorldTool())

// Look for friends/devices to help me
FogMachine.fogMachineInstance.startSearchForPeers()

// Run HelloWorldTool on all the nodes in the Fog Machine mesh-network and say hello to everyone!
FogMachine.fogMachineInstance.execute()

Pros & Cons

Parallel processing over a mesh-network reduces the overall time to solve problems by taking advantage of shared resources provided by each peer, such as processors and memory. Some of the pros and cons of using the Fog Machine framework are listed below.

Pros

  • Fog Machine allows your application to easily take advantage of the shared resources like processors, memory, and storage of all the devices in the mesh network; which can considerably increase performance. The table below shows how increasing the number of devices in the peer network decreases the overall search time for the FogStringSearch app provided.
# of Devices FogStringSearch Runtime (seconds)
1 42.5
2 33.6
3 32.7
4 30.0
  • The Fog Machine framework uses Apple's Multipeer Connectivity framework. Multipeer Connectivity is supported across all iOS devices, which means great interoperability within the iOS family.
  • The traffic between peers is encrypted by default with TDLS provided by Apple's Multipeer Connectivity framework.
  • The framework works entirely disconnected. It does not rely on any backend connection like LTE or Wi-Fi.
  • If, for whatever reason, a device in the peer network fails to process its piece of work, that piece of work will automatically get reprocessed on the initiating device. Reprocessing provides transparent flexibility in the network.
  • Although not the primary focus of Fog Machine, the framework allows devices to easily share data within the peer network.

Cons

  • The peer network communication relies on Wi-Fi or Bluetooth chipset and may not be reliable enough if your devices are not in close enough proximity to one another.
  • Introducing a considerably slower device (relative to the other devices) to your network could result in worse performance.
    • Example: Consider a peer network with two iPhone 6s and one iPhone 4s. If each peer device has to process the same number of instructions, then the two iPhone 6s will finish considerably faster than the iPhone 4s. After the two iPhone 6s devices finish they will wait idly for the iPhone 4s to finish processing.
    • If using peer devices of varying processing power is a concern, then logic can easily be added to the FMTool's lifecycle to account for the discrepancy.
  • The communication overhead between devices is based on the size of your FMWork and FMResult. The size of these components are likely small, but in a case where it is necessary to send a very large amount of data between devices, then the increase in communication time could exceed the decrease gained by parallel processing. If this is the case, you will likely need to re-evaluate your design.
  • A peer network is currently limited to 8 devices.

Requirements

Fog Machine requires iOS 9.0+.

Pull Requests

If you'd like to contribute to this project, please make a pull request. We'll review the pull request and discuss the changes. All pull request contributions to this project will be released under the MIT license.

Software source code previously released under an open source license and then modified by NGA staff is considered a "joint work" (see 17 USC § 101); it is partially copyrighted, partially public domain, and as a whole is protected by the copyrights of the non-government authors and must be released according to the terms of the original open source license.

Acknowledgements

Fog Machine makes use of the following open source projects:

More Repositories

1

geoq

Django web application to collect geospatial features and manage feature collection among groups of users
JavaScript
652
star
2

hootenanny

Hootenanny conflates multiple maps into a single seamless map.
JavaScript
337
star
3

geopackage-js

GeoPackage JavaScript Library
TypeScript
304
star
4

sarpy

A basic Python library to demonstrate reading, writing, display, and simple processing of complex SAR data using the NGA SICD standard.
Python
244
star
5

gamification-server

Server to track gamification elements (badges, points, tags) to work pages or apps
JavaScript
239
star
6

MATLAB_SAR

A basic MATLAB library to demonstrate reading, writing, display, and simple processing of complex SAR data using the NGA SICD standard.
MATLAB
209
star
7

mrgeo

MrGeo is a geospatial toolkit designed to provide raster-based geospatial capabilities that can be performed at scale. MrGeo is built upon Apache Spark and the Hadoop ecosystem to leverage the storage and processing of hundreds of commodity computers. See the wiki for more details.
Java
199
star
8

opensphere

OpenSphere
JavaScript
183
star
9

elasticgeo

ElasticGeo provides a GeoTools data store that allows geospatial features from an Elasticsearch index to be published via OGC services using GeoServer.
Java
167
star
10

scale

Processing framework for containerized algorithms
Python
105
star
11

geopackage-android

GeoPackage Android Library
Java
87
star
12

mage-server

Mobile Awareness GEOINT Environment Server
TypeScript
85
star
13

geopackage-java

GeoPackage Java Library
Java
77
star
14

tiff-java

Tagged Image File Format Java Library
Java
72
star
15

six-library

Sensor Independent XML Library
C++
70
star
16

social-media-picture-explorer

Backend for social-media-picture-explorer-ui, a tool for using deep learning to interactively explore social media
Jupyter Notebook
52
star
17

geopackage-ios

GeoPackage iOS Library
Objective-C
50
star
18

mage-android

Mobile Awareness GEOINT Environment Android
Kotlin
40
star
19

geoevents

The GeoEvents project is a dynamic and customizable open source web presence that provides a common operational picture to consolidate activities, manage content, and provides a single point of discovery. GeoEvents was used by deployers and first responders in over 100 real-world events.
JavaScript
40
star
20

MAGE

Main Page for the Mobile Awareness GEOINT Environment
JavaScript
39
star
21

GeoPackage

Main Page for NGA GeoPackage Efforts
39
star
22

geopackage-mapcache-android

GeoPackage MapCache Android App
Python
35
star
23

mage-ios

Mobile Awareness GEOINT Environment iOS
Swift
34
star
24

simple-features-geojson-java

Simple Features GeoJSON Java Library
Java
33
star
25

geopackage-android-map

GeoPackage Android Map Library
Java
33
star
26

geopackage-core-java

GeoPackage Core Java Library
Java
31
star
27

geoint-standards

co-create and grow GEOINT standards transparenlty
HTML
30
star
28

tiff-ios

Tagged Image File Format iOS Library
Objective-C
29
star
29

mapcache-electron

Desktop application for creating and editing GeoPackages
JavaScript
29
star
30

opensphere-desktop

opensphere-desktop
Java
29
star
31

hootenanny-ui

Hootenanny UI is a submodule of the Hootennany vector conflation project.
JavaScript
28
star
32

voxel-globe

calibrates aerial camera models and constructs 3D models from video sequences
Python
26
star
33

endpoint.js

Web application discovery, execution and streaming library
JavaScript
26
star
34

geoq-chef-installer

Chef recipes and configuration files to install the 'geoq' app onto a Virtual Machine
Ruby
25
star
35

map-of-world-api

Map of the World API supports multiple web-based mapping libraries and provides a consistent set of methods for interacting with any supported implementations
JavaScript
25
star
36

Nounalyzer

Analyze the nouns and entities in a rss feed
HTML
21
star
37

mapcache-server

MapCache Server
JavaScript
21
star
38

geopackage-mapcache-ios

GeoPackage MapCache iOS App
Objective-C
21
star
39

simple-features-wkb-java

Simple Features Well-Known Binary Java Library
Java
20
star
40

state-of-the-data

content suitability assessment tools
Python
19
star
41

social-media-picture-explorer-ui

A user interface to explore social media more graphically
JavaScript
19
star
42

Rational-Polynomial-Coefficients-Mapper

C++ class that uses RPC coefficients to map an object space coordinate represented in Latitude, Longitude, and Altitude to a sensor position represented in X,Y
C++
19
star
43

csm

Community Sensor Model
C++
18
star
44

mgrs-java

Military Grid Reference System Java Library
Java
18
star
45

leaflet-geopackage

Leaflet GeoPackage
JavaScript
18
star
46

anti-piracy-android-app

Anti-Shipping Activity Messages (ASAM) App for Android displays location and descriptive information about hostile acts against ships and mariners. The app caches warning data and works without a Wi-Fi or cellular connection.
Java
18
star
47

conduit

content curation tool
JavaScript
17
star
48

simple-features-java

Simple Features Java Library
Java
16
star
49

sarpy_apps

Python
16
star
50

anti-piracy-iOS-app

Anti-Shipping Activity Messages (ASAM) App for iOS displays location and descriptive information about hostile acts against ships and mariners. The app caches warning data and works without a Wi-Fi or cellular connection.
Swift
16
star
51

mage-ios-sdk

Mobile Awareness GEOINT Environment iOS SDK
Objective-C
15
star
52

geopackage-viewer-js

JavaScript
15
star
53

geoint-in-motion

data comparison tools written in python
Python
14
star
54

disconnected-content-explorer-iOS

Disconnected Interactive Content Explorer (DICE) is an app for iOS, Android, and Windows that allows users to load interactive content generated in HTML, CSS, and Javascript to a mobile device so the device can display interactive content without a network connection.
Objective-C
14
star
55

disconnected-content-explorer-android

Disconnected Interactive Content Explorer (DICE) is an app for iOS, Android, and Windows that allows users to load interactive content generated in HTML, CSS, and Javascript to a mobile device so the device can display interactive content without a network connection.
Java
13
star
56

color-java

Color Java Library
Java
13
star
57

keycloak-login.gov-integration

HTML
12
star
58

rfi-generator

The RFI Generator helps first responders and HQ analysts work Requests for Information (RFIs) within a geospatial context.
JavaScript
12
star
59

simple-features-proj-java

Simple Features Projection Java Library
Java
11
star
60

mgrs-ios

Military Grid Reference System iOS Library
Swift
10
star
61

Geospatial-Analysis-Integrity-Tool

The Geospatial Analysis Integrity Tool (GAIT) validates data against a data model. GAIT checks geometry, feature codes, attribute values and domains, and metadata. The tool writes its results as line and point shapefiles to an output directory. GAIT can execute against data in MGCP, GIFD, TDS, and VMap data models.
C
10
star
62

Sensor_Integration_Framework

The purpose of this document is to provide guidance required for sensor data producers and consumers to implement a sensor information enterprise that meets operational requirements, achieves United States (U.S.) Department of Defense (DoD) and Intelligence Community (IC) Chief Information Officer (CIO) goals, and conforms to applicable policy.
10
star
63

mrgeo-geoserver-plugin

Java
9
star
64

cocreate

Open source environment for development, integration and testing
Python
9
star
65

opensphere-asm

opensphere-asm
JavaScript
9
star
66

opensphere-electron

Run OpenSphere in an Electron container.
JavaScript
9
star
67

Spectral-Library-Reader

C++ Library that reads the splib06a file, which is a custom binary spectral reflectance database file created by USGS
C++
8
star
68

opensphere-yarn-workspace

opensphere-yarn-workspace
Dockerfile
8
star
69

mgrs-android

Military Grid Reference System Android Library
Java
8
star
70

ogc-api-features-json-java

OGC API Features JSON Java Library
Java
8
star
71

wedge-maker-4-gis

An ArcGIS Python toolbox for creating wedge and arcband shapes
Python
8
star
72

projections-ios

Projections iOS Library
Objective-C
7
star
73

SWIRSignalDetection

analyzes shortwave infrared reflectance
Cuda
7
star
74

geogig

Java
7
star
75

mgrs-js

Military Grid Reference System Javascript Library
TypeScript
7
star
76

tk_builder

Python
7
star
77

coordinate-reference-systems-java

Coordinate Reference Systems Java Library
Java
7
star
78

scale-ui

UI front-end for Scale - Processing framework for containerized algorithms
TypeScript
6
star
79

DigitalGlobeReader

C++
6
star
80

geopackage-geojson-js

GeoPackage GeoJSON Converter
JavaScript
6
star
81

mage-android-wear

Mobile Awareness GEOINT Environment Android Wear
Java
6
star
82

seed

Standard for discovery and consumption of Docker containerized jobs.
SCSS
6
star
83

grid-js

Grid Javascript Library
TypeScript
6
star
84

geowave-osm

OSM Data processing for GeoWave
Java
5
star
85

mage-android-wear-bridge

MAGE Android Wear Bridge
Java
5
star
86

hootenanny-rpms

RPMs needed for a Hootenanny install
Shell
5
star
87

simple-features-wkb-ios

Simple Features Well-Known Binary iOS Library
Objective-C
5
star
88

simple-features-wkt-java

Simple Features Well-Known Text Java Library
Java
5
star
89

mage-chronostouch-android

Mobile Awareness GEOINT Environment Chronostouch Android
Java
5
star
90

seed-silo

Rest API for discovering Seed images
Go
5
star
91

seed-cli

Algorithm developer CLI supporting Seed compliant image publish and testing.
Go
5
star
92

geowave-vagrant

Vagrant environment for geowave development.
Shell
5
star
93

marlin-ios

Swift
4
star
94

geogig-qgis-client-plugin

Python
4
star
95

ogc-api-features-json-ios

OGC API Features JSON iOS Library
Objective-C
4
star
96

opensphere-plugin-example

opensphere-plugin-example
JavaScript
4
star
97

geoevents-chef-installer

This is a set of Chef recipes (think of them as macros to automatically build a running Virtual Machine) that will work to set the geoevents app up on either a local Virtualbox VM or onto an Amazon Web Service VM.
Ruby
4
star
98

gars-java

Global Area Reference System Java Library
Java
3
star
99

opensphere-build-index

opensphere-build-index
JavaScript
3
star
100

grid-ios

Grid iOS Library
Swift
3
star