Permalink
Browse files

Merge branch 'master' of github.com:JuliaLang/julia

  • Loading branch information...
2 parents 19ee7b0 + a57a85e commit 0285d8d9fe5d08f4c17426602d243a939d036a86 @JeffBezanson JeffBezanson committed Oct 16, 2012
Showing with 179 additions and 128 deletions.
  1. +3 −0 .mailmap
  2. +1 −1 Makefile
  3. +2 −0 base/export.jl
  4. +10 −3 base/file.jl
  5. +2 −2 base/librandom.jl
  6. +9 −7 base/multi.jl
  7. +10 −10 base/osutils.jl
  8. +2 −2 base/rng.jl
  9. +12 −12 deps/Makefile
  10. +103 −86 deps/random/randmtzig.c
  11. +9 −2 doc/stdlib/profile.rst
  12. +4 −0 extras/iostring.jl
  13. +2 −2 extras/ode.jl
  14. +1 −1 src/sys.c
  15. +9 −0 test/file.jl
View
@@ -70,3 +70,6 @@ Andreas Noack Jensen <andreasnoackjensen@gmail.com> <andreas@Andreass-MacBook-Pr
Westley Argentum Hennigh <WestleyArgentum@gmail.com> <WestleyArgentum@gmail.com>
Westley Argentum Hennigh <WestleyArgentum@gmail.com> <whennigh@forio.com>
+
+George V. Neville-Neil <gnn@freebsd.org> <gnn@freebsd.org>
+George V. Neville-Neil <gnn@freebsd.org> <gvnn3>
View
@@ -42,7 +42,7 @@ install: release
cp $(BUILD)/bin/*julia* $(PREFIX)/bin
cd $(PREFIX)/bin && ln -s julia-release-$(DEFAULT_REPL) julia
cp -R -L $(BUILD)/lib/julia/* $(PREFIX)/lib/julia
- -cp $(BUILD)/lib/lib{Rmath,amd,amos,arpack,cholmod,colamd,fdm,fftw3,fftw3f,fftw3_threads,fftw3f_threads,glpk,glpk_wrapper,gmp,gmp_wrapper,grisu,history,julia-release,$(OPENBLASNAME),openlibm,pcre,random,readline,suitesparse_wrapper,umfpack,z}.$(SHLIB_EXT) $(PREFIX)/lib
+ -cp $(BUILD)/lib/lib{Rmath,amd,amos,arpack,cholmod,colamd,fdm,fftw3,fftw3f,fftw3_threads,fftw3f_threads,glpk,glpk_wrapper,gmp,gmp_wrapper,grisu,history,julia-release,$(OPENBLASNAME),openlibm,pcre,random,readline,suitesparse_wrapper,tk_wrapper,umfpack,z}.$(SHLIB_EXT) $(PREFIX)/lib
# Web-REPL stuff
-cp $(BUILD)/lib/mod* $(PREFIX)/lib
-cp $(BUILD)/sbin/* $(PREFIX)/sbin
View
@@ -1262,6 +1262,8 @@ export
@elapsed,
@windows_only,
@unix_only,
+ @osx_only,
+ @linux_only,
@sync,
@spawn,
@spawnlocal,
View
@@ -226,14 +226,21 @@ function dir_remove(directory_name::String)
run(`rmdir $directory_name`)
end
-function tempdir()
+@linux_only function tempdir()
+ chomp(readall(`mktemp -d`))
+end
+
+@osx_only function tempdir()
chomp(readall(`mktemp -d -t tmp`))
end
-function tempfile()
- chomp(readall(`mktemp -t tmp`))
+@linux_only function tempfile()
+ chomp(readall(`mktemp`))
end
+@osx_only function tempfile()
+ chomp(readall(`mktemp -t tmp`))
+end
function download_file(url::String)
filename = tempfile()
run(`curl -o $filename $url`)
View
@@ -173,7 +173,7 @@ end
function randmtzig_fill_randn!(A)
ccall(dlsym(Base.librandom, :randmtzig_fill_randn),
Void,
- (Ptr{Float64}, Uint32),
+ (Ptr{Float64}, Int),
A, numel(A))
return A
end
@@ -187,7 +187,7 @@ end
function randmtzig_fill_exprnd!(A)
ccall(dlsym(Base.librandom, :randmtzig_fill_exprnd),
Void,
- (Ptr{Float64}, Uint32),
+ (Ptr{Float64}, Int),
A, numel(A))
return A
end
View
@@ -1439,14 +1439,16 @@ function pmap(f, lsts...)
next_idx() = (idx=i; i+=1; idx)
@sync begin
for p=1:np
- @spawnat myid() begin
- while true
- idx = next_idx()
- if idx > n
- break
+ if p != myid() || np == 1
+ @spawnat myid() begin
+ while true
+ idx = next_idx()
+ if idx > n
+ break
+ end
+ results[idx] = remote_call_fetch(p, f,
+ map(L->L[idx], lsts)...)
end
- results[idx] = remote_call_fetch(p, f,
- map(L->L[idx], lsts)...)
end
end
end
View
@@ -1,19 +1,19 @@
include("os_detect.jl")
macro windows_only(ex)
- if(OS_NAME == :Windows)
- return esc(ex)
- else
- return :nothing
- end
+ OS_NAME == :Windows ? esc(ex) : :nothing
end
macro unix_only(ex)
- if(_jl_is_unix(OS_NAME))
- return esc(ex)
- else
- return :nothing
- end
+ _jl_is_unix(OS_NAME) ? esc(ex) : :nothing
+end
+
+macro osx_only(ex)
+ OS_NAME == :Darwin ? esc(ex) : :nothing
+end
+
+macro linux_only(ex)
+ _jl_is_unix(OS_NAME) && OS_NAME != :Darwin ? esc(ex) : :nothing
end
_jl_os_name(os::Symbol) = string(os)
View
@@ -267,7 +267,7 @@ end
function randg!(a::Real, A::Array{Float64})
if a <= 0. error("shape parameter a must be > 0") end
- d = (a < 1. ? a + 1 : a) - 1.0/3.0
+ d = (a <= 1. ? a + 1 : a) - 1.0/3.0
c = 1.0/sqrt(9.0d)
for i in 1:numel(A) A[i] = randg2(d, c) end
if a < 1.
@@ -279,7 +279,7 @@ end
function randg(a::Real)
if a <= 0. error("shape parameter a must be > 0") end
- d = (a < 1. ? a + 1 : a) - 1.0/3.0
+ d = (a <= 1. ? a + 1 : a) - 1.0/3.0
randg2(d, 1.0/sqrt(9.0d)) * (a > 1. ? 1. : rand()^(1./a))
end
View
@@ -12,7 +12,7 @@ include $(JULIAHOME)/Make.inc
# prevent installing libs into usr/lib64 on opensuse
unexport CONFIG_SITE
-STAGE1_DEPS = uv fdlibm dsfmt rmath double-conversion amos glpk
+STAGE1_DEPS = uv fdlibm random rmath double-conversion amos glpk
STAGE2_DEPS = gmp-wrapper
STAGE3_DEPS = suitesparse-wrapper
@@ -378,7 +378,7 @@ RMATH_OBJ_SOURCE = Rmath/src/libRmath.$(SHLIB_EXT)
compile-rmath: $(RMATH_OBJ_SOURCE)
install-rmath: $(RMATH_OBJ_TARGET)
-$(RMATH_OBJ_SOURCE): Rmath/src/Makefile install-dsfmt
+$(RMATH_OBJ_SOURCE): Rmath/src/Makefile install-random
cd Rmath/src && \
$(MAKE) CC="$(CC)" && \
$(INSTALL_NAME_CMD)libRmath.$(SHLIB_EXT) libRmath.$(SHLIB_EXT)
@@ -411,18 +411,18 @@ clean-amos:
rm -f $(AMOS_OBJ_SOURCE) $(AMOS_OBJ_TARGET)
distclean-amos: clean-amos
-## DSFMT ##
+## LIBRANDOM ##
-DSFMT_OBJ_TARGET = $(USRLIB)/librandom.$(SHLIB_EXT)
-DSFMT_OBJ_SOURCE = random/librandom.$(SHLIB_EXT)
+LIBRANDOM_OBJ_TARGET = $(USRLIB)/librandom.$(SHLIB_EXT)
+LIBRANDOM_OBJ_SOURCE = random/librandom.$(SHLIB_EXT)
-LIBRANDOM_CFLAGS = $(CFLAGS) -O3 -finline-functions -fomit-frame-pointer -DNDEBUG -fno-strict-aliasing --param max-inline-insns-single=1800 -Wmissing-prototypes -Wall -std=c99 -DDSFMT_MEXP=19937 $(fPIC) -shared -DDSFMT_DO_NOT_USE_OLD_NAMES
+LIBRANDOM_CFLAGS = $(CFLAGS) -O3 -finline-functions -fomit-frame-pointer -DNDEBUG -fno-strict-aliasing --param max-inline-insns-single=1800 -Wmissing-prototypes -Wall -std=c99 -DDSFMT_MEXP=19937 $(fPIC) -shared -DDSFMT_DO_NOT_USE_OLD_NAMES
ifeq ($(ARCH), x86_64)
LIBRANDOM_CFLAGS += -msse2 -DHAVE_SSE2
endif
-compile-dsfmt: $(DSFMT_OBJ_SOURCE)
-install-dsfmt: $(DSFMT_OBJ_TARGET)
+compile-random: $(LIBRANDOM_OBJ_SOURCE)
+install-random: $(LIBRANDOM_OBJ_TARGET)
random/dsfmt-$(DSFMT_VER).tar.gz:
$(WGET_DASH_O) $@ http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/SFMT/dSFMT-src-$(DSFMT_VER).tar.gz
@@ -433,17 +433,17 @@ random/jl_random.c: random/dsfmt-$(DSFMT_VER).tar.gz
tar -C dsfmt-$(DSFMT_VER) --strip-components 1 -xf dsfmt-$(DSFMT_VER).tar.gz && \
cd dsfmt-$(DSFMT_VER) && patch < ../dSFMT.h.patch
touch $@
-$(DSFMT_OBJ_SOURCE): random/jl_random.c
+$(LIBRANDOM_OBJ_SOURCE): random/jl_random.c random/randmtzig.c
cd random && \
$(CC) $(LIBRANDOM_CFLAGS) jl_random.c -o librandom.$(SHLIB_EXT) && \
$(INSTALL_NAME_CMD)librandom.$(SHLIB_EXT) librandom.$(SHLIB_EXT)
-$(DSFMT_OBJ_TARGET): $(DSFMT_OBJ_SOURCE)
+$(LIBRANDOM_OBJ_TARGET): $(LIBRANDOM_OBJ_SOURCE)
cp $< $@
-clean-dsfmt:
+clean-random:
rm -f random/librandom.$(SHLIB_EXT)
-distclean-dsfmt: clean-dsfmt
+distclean-random: clean-random
cd random && rm -rf *.tar.gz dsfmt-$(DSFMT_VER)
## OpenBLAS ##
Oops, something went wrong.

0 comments on commit 0285d8d

Please sign in to comment.