D4M.jl: A D4M Module for Julia

Julia-D4M

A Dynamic Distributed Dimensional Data Model(D4M) module for Julia. D4M was developed in MATLAB by Dr Jeremy Kepner and his team at Lincoln Labs. The goal is to implement D4M in a native Julia method. As a course project in Numeric Computation with Julia, various parts of this implementation has been completed and compared with the original matlab in performance. In the matrix performance example folder (testing performance in matrix like operations such as add and multiply), this implementation has achieved on par if not significant speed up (10x). This is thanks to the effectiveness of Julia base in comparision to Matlab.

The D4M Project Page: http://www.mit.edu/~kepner/D4M/

Current Status: (v0.5) - End of course project

  • Read and Write CSV
  • Printtable tabular
  • Basic and advanced Assoc method of indexing
  • All methods of construction Assoc implemented
  • Implemented 1Intro/1AssocIntro and 3Scaling/3MatrixPerformance example folders and dependency.

Next Version: (v0.6) [Mid Feburary]

  • Implement 1Intro/2EdgeArt and 2Apps/1EntityAnalysis example folders and dependency.
  • Add interfaces to Julia's native DataFrame, allowing user to transfer data back and forth from JuliaStats

Download Details:

Author: Achen12
Source Code: https://github.com/achen12/D4M.jl 
License: Apache-2.0 license

#julia #matlab #modules 

What is GEEK

Buddha Community

D4M.jl: A D4M Module for Julia

D4M.jl: A D4M Module for Julia

Julia-D4M

A Dynamic Distributed Dimensional Data Model(D4M) module for Julia. D4M was developed in MATLAB by Dr Jeremy Kepner and his team at Lincoln Labs. The goal is to implement D4M in a native Julia method. As a course project in Numeric Computation with Julia, various parts of this implementation has been completed and compared with the original matlab in performance. In the matrix performance example folder (testing performance in matrix like operations such as add and multiply), this implementation has achieved on par if not significant speed up (10x). This is thanks to the effectiveness of Julia base in comparision to Matlab.

The D4M Project Page: http://www.mit.edu/~kepner/D4M/

Current Status: (v0.5) - End of course project

  • Read and Write CSV
  • Printtable tabular
  • Basic and advanced Assoc method of indexing
  • All methods of construction Assoc implemented
  • Implemented 1Intro/1AssocIntro and 3Scaling/3MatrixPerformance example folders and dependency.

Next Version: (v0.6) [Mid Feburary]

  • Implement 1Intro/2EdgeArt and 2Apps/1EntityAnalysis example folders and dependency.
  • Add interfaces to Julia's native DataFrame, allowing user to transfer data back and forth from JuliaStats

Download Details:

Author: Achen12
Source Code: https://github.com/achen12/D4M.jl 
License: Apache-2.0 license

#julia #matlab #modules 

KDSP.jl: DSP Module for Julia

DSP.jl provides a number of common DSP routines in Julia. So far, the following functions are implemented:

digital filtering:

  • filt

correlation and convolution:

  • conv
  • conv2
  • deconv
  • xcorr

FFTs provided by FFTW interface:

  • bfft
  • bfftn
  • brfft
  • brfftn
  • fft
  • fft2
  • fft3
  • fftn
  • ifft
  • ifft2
  • ifft3
  • ifftn
  • irfft
  • irfftn
  • rfft
  • rfftn

FFT utilities:

  • fftshift
  • ifftshift

periodogram estimation:

  • periodogram
  • welch_pgram
  • bartlett_pgram

window functions:

  • rect
  • hanning
  • hamming
  • tukey
  • cosine
  • lanczos
  • triang
  • bartlett
  • gaussian
  • bartlett_hann
  • blackman
  • kaiser

common DSP mathematics:

  • sinc

auxiliary functions:

  • arraysplit

Download Details:

Author: Kofron
Source Code: https://github.com/kofron/KDSP.jl 
License: View license

#julia #module 

GLPK.jl: GLPK Wrapper Module for Julia

GLPK.jl

GLPK.jl is a wrapper for the GNU Linear Programming Kit library.

The wrapper has two components:

The C API can be accessed via GLPK.glp_XXX functions, where the names and arguments are identical to the C API. See the /tests folder for inspiration.

Installation

Install GLPK using Pkg.add:

import Pkg; Pkg.add("GLPK")

In addition to installing the GLPK.jl package, this will also download and install the GLPK binaries. (You do not need to install GLPK separately.)

To use a custom binary, read the Custom solver binaries section of the JuMP documentation.

Use with JuMP

To use GLPK with JuMP, use GLPK.Optimizer:

using JuMP, GLPK
model = Model(GLPK.Optimizer)
set_optimizer_attribute(model, "tm_lim", 60 * 1_000)
set_optimizer_attribute(model, "msg_lev", GLPK.GLP_MSG_OFF)

If the model is primal or dual infeasible, GLPK will attempt to find a certificate of infeasibility. This can be expensive, particularly if you do not intend to use the certificate. If this is the case, use:

model = Model() do
    return GLPK.Optimizer(want_infeasibility_certificates = false)
end

Callbacks

Here is an example using GLPK's solver-specific callbacks.

using JuMP, GLPK, Test

model = Model(GLPK.Optimizer)
@variable(model, 0 <= x <= 2.5, Int)
@variable(model, 0 <= y <= 2.5, Int)
@objective(model, Max, y)
reasons = UInt8[]
function my_callback_function(cb_data)
    reason = GLPK.glp_ios_reason(cb_data.tree)
    push!(reasons, reason)
    if reason != GLPK.GLP_IROWGEN
        return
    end
    x_val = callback_value(cb_data, x)
    y_val = callback_value(cb_data, y)
    if y_val - x_val > 1 + 1e-6
        con = @build_constraint(y - x <= 1)
        MOI.submit(model, MOI.LazyConstraint(cb_data), con)
    elseif y_val + x_val > 3 + 1e-6
        con = @build_constraint(y - x <= 1)
        MOI.submit(model, MOI.LazyConstraint(cb_data), con)
    end
end
MOI.set(model, GLPK.CallbackFunction(), my_callback_function)
optimize!(model)
@test termination_status(model) == MOI.OPTIMAL
@test primal_status(model) == MOI.FEASIBLE_POINT
@test value(x) == 1
@test value(y) == 2
@show reasons

Download Details:

Author: jump-dev
Source Code: https://github.com/jump-dev/GLPK.jl 
License: Unknown, GPL-3.0 licenses found

#julia #wrapper #module 

CPUTime.jl: Julia Module for CPU Timing

CPUTime.jl

A Julia package for measuring elapsed CPU time in Julia.

Installation

You should only use this package if you know what you're doing - CPU time on multi-core processors is a tricky beast. Please at least read the discussion in Issue #1 before proceeding. Once you've done that, to install call:

Pkg.add("CPUTime")

from the Julia command line.

Functions and Macros

The exported functions and macros, as well as their absolute time equivalents, are listed in the following table.

Real time (Julia standard library)CPU time (CPUTime.jl)
time_ns()CPUtime_us()
tic()CPUtic()
toq()CPUtoq()
toc()CPUtoc()
@time@CPUtime
@elapsed@CPUelapsed

Note that the finest resolution for CPU time is microseconds, as opposed to nanoseconds for absolute time.

Usage Example

using CPUTime

function add_and_sleep()
    x = 0
    for i in 1:10_000_000
        x += i
    end
    sleep(1)
    x
end

@time @CPUtime add_and_sleep()
elapsed CPU time: 0.000174 seconds
  1.005624 seconds (32 allocations: 1.109 KiB)
50000005000000

Download Details:

Author: schmrlng
Source Code: https://github.com/schmrlng/CPUTime.jl 
License: View license

#julia #module #cpu

Kip.jl: An Alternative Module System for Julia

Kip

Kip is an alternative module system for Julia with the goal of being more robust and easier to use. With Kip packages don't have names. Instead modules are identified by the file they are in. So you can have several versions of the same package without them overwriting each other. Also it favours putting dependency info inline rather than in a REQUIRE file. This reduces indirection and works well at the REPL. The final key difference is that it installs dependencies at runtime. So you never have to think about if a package is installed or not. Though you should run Kip.update() occasionally to update Kip's local cache of packages which are just plain Git repositories.

Installation

Pkg.clone("https://github.com/jkroso/Kip.jl.git")

Then add this code to your ~/.julia/config/startup.jl

import Pkg
using Kip
haskey(ENV, "ATOM_HOME") && @use "github.com/jkroso/Rutherford.jl"

Now it's like Kip was built into Julia. It will be available at the REPL and in any files you run

API

Kip's API consists of just one macro to import modules. And one function to update all the 3rd party repositories you use

@use(pkg::String, imports::Symbol...)

@use takes a path to a package and a list of symbols to import from that package. If you want to use a different name locally for any of these symbols your can pass a Pair of symbols like @use "./thing" a => b. This will import a from the local package "./thing" and make it available as b.

Now I just need to explain the syntax of the path parameter. In this example I'm using a relative path which is resolved relative to the REPL's pwd(). Or if I was editing a file it would be the dirname() of that file. This should be familiar for people who use Unix machines. Now, assuming we are at the REPL, what @use does under the hood is check for a file called joinpath(pwd(), "./thing"). If it exists it will load it. Otherwise it tries a few other paths joinpath(pwd(), "./thing.jl"), joinpath(pwd(), "./thing/main.jl"), and joinpath(pwd(), "./thing/src/thing.jl"). This just enables you to save a bit of typing if you feel like it.

There are a couple other types of paths you can pass to @use:

Absolute: @use "/Users/jkroso/thing"

Github: @use "github.com/jkroso/thing"

This syntax is actually pretty complex since it also needs to enable you to specify which ref (tag/commit/branch) you want to use. Here I haven't specified a ref so it uses the latest commit. If I want to specify one I put it after the reponame prefixed with an "@". e.g: @use "github.com/jkroso/thing@1" This looks like a semver query so it will be run over all tags in the repo and the latest tag that matches the query is the one that gets used. Finally, if the module we want from the repository isn't called "main.jl", or "src/$(reponame).jl" then we will need to specify its path. e.g: @use "github.com/jkroso/thing@1/thing". And path completion will also be applied just like with relative and absolute paths.

update()

Runs git fetch on all the repositories you have @use'd in the past. So that next time you @use them you will get the latest version

Native Julia module support

If the module you require is registered in Pkg.dir("METADATA") then it will be installed and loaded using the built in module system. So @use "github.com/johnmyleswhite/Benchmark.jl" compare is exactly equivalent to import Benchmark: compare. This reduces the likelihood of ending up with duplicate modules being loaded within Kip and Pkg's respective caches. Especially while Julia doesn't provide any good way to load non-registered modules.

Kip also supports non-registered modules by looking at the contents of the file you are requiring to see if the only thing in it is a Module. When that's the case it will unbox it from the wrapper Kip normally uses. If Julia ever provides good support for non-registered modules itself then Kip will Pkg.clone the module and import it to match its handling of registered modules.

Running arbitrary code on another machine

Since dependencies are declared in the code you can pipe arbitrary code into a machine running Julia and have the results piped back. Or on the other hand you could curl $url | julia to run remote code on your local machine. Here is an example of running some code through a docker instance (BTW so long as you have docker installed you can run this)

$ echo '@use "github.com/coiljl/URI" encode; encode("1 <= 2")' | docker run -i jkroso/kip.jl
"1%20%3C=%202"

Example projects

Jest

This demonstrates mixed use of native modules and Kip modules. It also shows how nice Kip is for writing CLI programs. Since its dependencies will be installed at runtime Jest's CLI script only needs to be downloaded and put in the user's $PATH.

URI parser benchmark

Here Kip enabled me to put my benchmark code directly in this projects Readme.ipynb file since I didn't need to worry about installing the dependencies.

Prospective features

Automatic reloading of modules

While at the REPL it could listen to changes on the modules you require and automatically reload them into the workspace.

Dependency tree linting

Kips ability to load multiple versions of a module at the same time is a double edged sword. The upside is package developers can make breaking changes to their API's without instantly breaking all their dependent projects. The downside is that if you and your dependencies have dependencies in common and they load different versions of these modules to you then you might run into issues if you passing Type instances back and fourth between your direct dependencies. This is a subtle problem which can be hard to recognise. Especially if you not aware that it can happen. A good solution to this might be to use a static analysis tool to check your dependency tree for potential instances of this problem. It would make sense to make it part of a linting tool.

Download Details:

Author: jkroso
Source Code: https://github.com/jkroso/Kip.jl 

#julia #modules #system