*julia> const k=200000000;ERROR: cannot declare k constant; it already has 
a value:/Paul*
W dniu niedziela, 1 czerwca 2014 16:13:27 UTC+2 użytkownik Andreas Noack 
Jensen napisał:
>
> This is the usual problem with global variables in Julia. If you define k 
> by 
>
> const k=200000000
>
> the timing results should be similar.
>
>
> 2014-06-01 16:09 GMT+02:00 paul analyst <[email protected] <javascript:>>
> :
>
>>
>> D:\install\Julia\Julia 0.3.0-prerelease-win64-ver3\Julia 0.3.0-prerelease 
>> ver 3>bin\julia.exe -p 8
>>                _
>>    _       _ _(_)_     |  A fresh approach to technical computing
>>   (_)     | (_) (_)    |  Documentation: http://docs.julialang.org
>>    _ _   _| |_  __ _   |  Type "help()" to list help topics
>>   | | | | | | |/ _` |  |
>>   | | |_| | | | (_| |  |  Version 0.3.0-prerelease+2599 (2014-04-11 23:52 
>> UTC)
>>  _/ |\__'_|_|_|\__'_|  |  Commit bf7096c (50 days old master)
>> |__/                   |  x86_64-w64-mingw32
>>
>> julia> procs()
>> 9-element Array{Int64,1}:
>>  1
>>  2
>>  3
>>  4
>>  5
>>  6
>>  7
>>  8
>>  9
>>
>> julia> tic();
>>
>> julia> nheads = @parallel (+) for i=1:200000000
>>        int(randbool())
>>        end
>> 100006468
>>
>> julia> toc()
>> elapsed time: 2.77418807 seconds
>> 2.77418807
>>
>> julia>exit()
>>
>>
>> D:\install\Julia\Julia 0.3.0-prerelease-win64-ver3\Julia 0.3.0-prerelease 
>> ver 3>bin\julia.exe -p 8
>>                _
>>    _       _ _(_)_     |  A fresh approach to technical computing
>>   (_)     | (_) (_)    |  Documentation: http://docs.julialang.org
>>    _ _   _| |_  __ _   |  Type "help()" to list help topics
>>   | | | | | | |/ _` |  |
>>   | | |_| | | | (_| |  |  Version 0.3.0-prerelease+2599 (2014-04-11 23:52 
>> UTC)
>>  _/ |\__'_|_|_|\__'_|  |  Commit bf7096c (50 days old master)
>> |__/                   |  x86_64-w64-mingw32
>>
>> julia> k=200000000
>> 200000000
>>
>> julia> tic();
>>
>> julia> nheads = @parallel (+) for i=1:k
>>        int(randbool())
>>        end
>> 99989022
>>
>> julia> toc()
>> elapsed time: 18.631674663 seconds
>> 18.631674663
>>
>> julia>
>>
>> What hapend ?
>>
>> Paul
>>
>>
>>
>
>
> -- 
> Med venlig hilsen
>
> Andreas Noack Jensen
>  

Reply via email to