[julia-users] shared library created by ifort can't be imported correctly

2016-11-14 Thread
The julia code: !f90tojl.f90 module m contains integer function five() five = 5 end function five end module m The corresponding julia code: #test.jl println(ccall( (:__m_MOD_five, "f90tojl"), Int, () )) The test command and the result: (test is the directory, not a command) ➜ te

Re: [julia-users] shared library created by ifort can't be imported correctly

2016-11-15 Thread
在 2016年11月15日星期二 UTC+8下午4:29:17,Ángel de Vicente写道: > > Hi, > > 博陈 > writes: > > The julia code: > > > > !f90tojl.f90 > > module m > > contains > > integer function five() > > five = 5 > > end function five > &g

[julia-users] Julia calling MKL functions from fortran shared library

2016-11-15 Thread
These days, I tried a walkaround to implement FFT in julia with the help of the MKL fft properties. I wrote a fortran module with several subroutines, in some of which the MKL FFT function was called. The fortran file was compiled to a shared library. ifort modules.f90 -parallel -mkl -

Re: [julia-users] Re: Julia calling MKL functions from fortran shared library

2016-11-15 Thread
在 2016年11月16日星期三 UTC+8上午12:49:13,Ángel de Vicente写道: > > Hi, > > I wanted to try this out. My test Fortran module is the following, which > I compile with: ifort -mkl -o test_mod.so test_mod.f90 -shared -fpic > , > | module testmodule > | > | implicit none > | > | double precision

[julia-users] Why is my code so slow?

2015-12-08 Thread
function ground() #using PyPlot print("start") const R = 320. const Ks = 2^11 const x = linspace(-R, R, Ks+1) const dx = 2R/Ks const y = x const dt = 0.1 const pm = 2π/2dx px = circshift( linspace(-pm, pm, Ks+1), round(Int64, Ks/2) ) py = px FFTW.se

[julia-users] Re: Why is my code so slow?

2015-12-08 Thread
Thanks for your attention, but I got the right result with this code, and the .* and ./ operators takes about 0.2 seconds in each loop. I guess that difference comes from the use of Devectorize package. 在 2015年12月8日星期二 UTC+8下午11:45:57,Kristoffer Carlsson写道: > > The .* and ./ operators are slow

[julia-users] The optimization strategy for fft didn't work

2015-12-09 Thread
the optimization strategy for fft given by the official documentation seems to fail. Why?

Re: [julia-users] The optimization strategy for fft didn't work

2015-12-09 Thread
difference. But I'm just confused why the fft! and plan_fft strategy didn't work, which was clearly explained by you. 在 2015年12月9日星期三 UTC+8下午9:09:07,Yichao Yu写道: > > > > On Wed, Dec 9, 2015 at 5:57 AM, 博陈 > > wrote: > >> >> <https://lh3.

[julia-users] A Julia code slower than Matlab, can it be faster?

2015-12-13 Thread
This is my first julia code, I am happy it did the right thing, but compared with the Matlab code that did the same thing, it runs so slowly. The Matlab code takes about 90s, but the julia below takes 130s. Potential(x::Float64, y::Float64) = -2./sqrt(x^2+1.) -2./sqrt(y^2+1.) + 1./sqrt((x-y)^2

Re: [julia-users] A Julia code slower than Matlab, can it be faster?

2015-12-14 Thread
年12月15日星期二 UTC+8上午2:15:11,Yichao Yu写道: > > On Mon, Dec 14, 2015 at 1:12 PM, Yichao Yu > > wrote: > > On Sun, Dec 13, 2015 at 10:35 PM, 博陈 > > wrote: > >> This is my first julia code, I am happy it did the right thing, but > compared > >> with the

[julia-users] Re: A Julia code slower than Matlab, can it be faster?

2015-12-14 Thread
n/stable/manual/performance-tips/>. > > Le lundi 14 décembre 2015 12:35:43 UTC+9, 博陈 a écrit : >> >> This is my first julia code, I am happy it did the right thing, but >> compared with the Matlab code that did the same thing, it runs so slowly. >> The

Re: [julia-users] Re: A Julia code slower than Matlab, can it be faster?

2015-12-15 Thread
delta phi is reassigned inside the loop at some point. >>> >>> Am 14.12.2015 um 10:31 schrieb Patrick Kofod Mogensen: >>> > Are you sure this version works? I get Δϕ == 1.0 in all iterations, so >>> I >>> > can't see how it would ever exit th

Re: [julia-users] A Julia code slower than Matlab, can it be faster?

2015-12-15 Thread
7;ll have a try. Finally, I do really appreciated all your help. Mainly following your advice, my code got great performance improvement. 在 2015年12月15日星期二 UTC+8上午2:13:12,Yichao Yu写道: > > On Sun, Dec 13, 2015 at 10:35 PM, 博陈 > > wrote: > > This is my first julia code, I am h

Re: [julia-users] Re: A Julia code slower than Matlab, can it be faster?

2015-12-15 Thread
Oh, thank you very very much. I am quite a green hand. Before following advises from you and Yichao, my code cost 133 s, but now, your version only cost 61 s! Although Yichao has pointed out almost all the optimization strategies and make things clear enough, I don't really know how to follow

Re: [julia-users] Re: A Julia code slower than Matlab, can it be faster?

2015-12-15 Thread
The code get great performance improvement. My original version cost 133 s and about 166 G memories, while your version cost 61 s and about 423M memories! 在 2015年12月15日星期二 UTC+8下午7:34:55,Pablo Zubieta写道: > > Stefan said that your code is well type (type stable). Have you tried > Yichao's sugg

Re: [julia-users] Re: A Julia code slower than Matlab, can it be faster?

2015-12-16 Thread
lieve that your repositories will make a great difference to my explore on Juila. 在 2015年12月15日星期二 UTC+8下午10:11:19,Yichao Yu写道: > > On Tue, Dec 15, 2015 at 7:42 AM, 博陈 > > wrote: > > The code get great performance improvement. My original version cost 133 > s > > and

[julia-users] Why can't julia make the most of the system resource?

2015-12-19 Thread
As can be seen, all the 8 cores of my pc is being used by the julia program, however, only 35% of the system resource is covered. My julia code mainly do

[julia-users] how can i rewrite the code to make use of the parallel feature in julia?

2016-06-23 Thread
This is my code, I wrote it with using ..Utils using JLD function ground(ϕ0::Array{Complex{Float64},2}, dx::Float64 , dt::Float64) FFTW.set_num_threads(CPU_CORES) ns = size( ϕ0, 1) x = get_x(ns, dx) p = get_p(ns, dx) # FFT plan p_fft! = plan_fft!( s

[julia-users] how can i rewrite my code to make use of the parallel feature of julia?

2016-06-23 Thread
Below is part of my code, I wrote it with FFTW.set_num_threads() to get parallel fft calculation. However, the for loops "for eachindex" are just serial. Is it possible to rewrite the code in a parallel way? I don't know how to implement it with @parallel, SharedArray or the simple @spawn featu

[julia-users] The Arrays are hard to pre-allocate for me, are they possible to be pre-allocated?

2016-03-29 Thread
First of all, have a look at the result. My code calculates the evolution of 1-d 2-electron system in the electric field, som

[julia-users] Re: hdf5 not installing on linux cluster node

2016-03-29 Thread
I have experienced by the same problem last two months, and finally figured out the solution. When you log in not as a root user, you can't install libraries like hdf5 or c-blosc with apt-get or yum. To install these libs, you should download them from https://www.hdfgroup.org/downloads/index.h

Re: [julia-users] The Arrays are hard to pre-allocate for me, are they possible to be pre-allocated?

2016-03-29 Thread
Actually, I know the arrays allocated in every loop, my problem is that I don't know the strategy to pre-allocate such arrays. In short, this is the pre-allocating problem of arrays like array a described below: n = 1024; nt = 1000; dt = 0.1 a = Array(Float64, n, n) for i in 1:nt t = i*dt

Re: [julia-users] The Arrays are hard to pre-allocate for me, are they possible to be pre-allocated?

2016-03-29 Thread
ng to profile it. 在 2016年3月29日星期二 UTC+8下午10:06:40,Yichao Yu写道: > > On Tue, Mar 29, 2016 at 10:00 AM, 博陈 > > wrote: > > Actually, I know the arrays allocated in every loop, my problem is that > I > > don't know the strategy to pre-allocate such arrays. > > I

Re: [julia-users] The Arrays are hard to pre-allocate for me, are they possible to be pre-allocated?

2016-03-29 Thread
二 UTC+8下午9:27:27,Stefan Karpinski写道: > > Have you tried: > > (a) calling @code_typewarn on your function > (b) using the built-in profiler? > > > On Tue, Mar 29, 2016 at 9:23 AM, 博陈 > > wrote: > >> First of all, have a look at the result. >> >>

Re: [julia-users] The Arrays are hard to pre-allocate for me, are they possible to be pre-allocated?

2016-03-29 Thread
sorry, but I give the lines in the citing area below the table. 在 2016年3月30日星期三 UTC+8上午12:50:30,Milan Bouchet-Valat写道: > > Le mardi 29 mars 2016 à 09:43 -0700, 博陈 a écrit : > > I tried the built-in profiler, and find that the problem lies in > > lines I end with **, t

Re: [julia-users] The Arrays are hard to pre-allocate for me, are they possible to be pre-allocated?

2016-03-29 Thread
flags parameter. If flags = (1, 1, 1, 1), the script calculate all the 4 quantities, while if flags=(0,0,0,0), the function just give me the final wave function. 在 2016年3月30日星期三 UTC+8上午1:15:07,Yichao Yu写道: > > > > On Tue, Mar 29, 2016 at 12:43 PM, 博陈 > > wrote: > >> I

Re: [julia-users] The Arrays are hard to pre-allocate for me, are they possible to be pre-allocated?

2016-03-29 Thread
ichao Yu写道: > > > > On Tue, Mar 29, 2016 at 12:43 PM, 博陈 > > wrote: > >> I tried the built-in profiler, and find that the problem lies in lines I >> end with **, the result is shown below: >> that proved my guess, how can I pre-allocate these arrays?

Re: [julia-users] The Arrays are hard to pre-allocate for me, are they possible to be pre-allocated?

2016-03-29 Thread
I rewrote my code and manually loop from 1:n, the pre-allocation problem is solved. I also added some parenthesis as you suggested, that helps, but not very much. 在 2016年3月30日星期三 UTC+8上午1:56:47,Yichao Yu写道: > > > > On Tue, Mar 29, 2016 at 1:50 PM, 博陈 > > wrote: >

Re: [julia-users] The Arrays are hard to pre-allocate for me, are they possible to be pre-allocated?

2016-03-29 Thread
e_warntype`? This might not be a preallocation issue, it might be > a > type-stability issue. > > --Tim > > On Tuesday, March 29, 2016 01:56:21 PM Yichao Yu wrote: > > On Tue, Mar 29, 2016 at 1:50 PM, 博陈 > > wrote: > > > Additionally, the allocation prob