Re: [julia-users] ArgParse @add_arg_table not recognized

2016-01-08 Thread Uthsav Chitra
Hi Kevin,

Sorry I haven't explained this too well. What I want to do is, from the 
REPL, run a program that has a function with @add_arg_table. But initially 
it was spitting out the error I had in my first post, even though I wasn't 
explicitly calling that function.

But I just restarted my Terminal and it works fine now-- that is, if I call 
include("arg.jl"), and arg.jl doesn't call the function with 
@add_arg_table, it doesn't complain-- so I'm not sure what happened.

Thanks for the help! I'll keep the DocOpt suggestion in mind-- I've had my 
fair share of problems with ArgParse.

On Friday, January 8, 2016 at 1:00:01 PM UTC-5, Kevin Squire wrote:
>
> Hi Uthsav, 
>
> Can you give some more details about what you're actually trying to do?
>
> If you're simply trying to break up your files, it should work fine.
>
> $ julia argparse_example3.jl --opt1 1 2 3
> Parsed args:
>   arg1  =>  Any["2","3"]
>   karma  =>  0
>   arg2  =>  Any["no_arg_given"]
>   opt1  =>  1
>
> $ echo 'include("argparse_example3.jl")' > arg_test.jl
> $ julia arg_test.jl --opt1 1 2 3
> Parsed args:
>   arg1  =>  Any["2","3"]
>   karma  =>  0
>   arg2  =>  Any["no_arg_given"]
>   opt1  =>  1
>
> On the other hand, if you're running from the REPL... well, first, I'm not 
> sure that makes much sense.  `ArgParse` is meant for parsing command line 
> arguments, and it's not possible right now to do that from the REPL:
>
> $ julia
>_
>_   _ _(_)_ |  A fresh approach to technical computing
>   (_) | (_) (_)|  Documentation: http://docs.julialang.org
>_ _   _| |_  __ _   |  Type "?help" for help.
>   | | | | | | |/ _` |  |
>   | | |_| | | | (_| |  |  Version 0.4.3-pre+6 (2015-12-11 00:38 UTC)
>  _/ |\__'_|_|_|\__'_|  |  Commit adffe19* (28 days old release-0.4)
> |__/   |  x86_64-apple-darwin14.5.0
>
> julia> include("argparse_example3.jl")
> required argument arg1 was not provided
> usage: argparse_example3.jl [--opt1 [OPT1]] [-k] arg1 arg1 [arg2...]
> $
>
> The best I could come up with was 
>
> $ julia -e 'include("argparse_example3.jl")' -- --opt1 1 2 3
> Parsed args:
>   arg1  =>  Any["2","3"]
>   karma  =>  0
>   arg2  =>  Any["no_arg_given"]
>   opt1  =>  1
>
> Which is doing essentailly the same thing as the previous example.
>
> (BTW, you might find DocOpt.jl to be a useful substitute.)
>
> Cheers,
>Kevin
>
>
> On Thu, Jan 7, 2016 at 4:16 PM, Uthsav Chitra <uthsav...@brown.edu 
> > wrote:
>
>> (Not sure how to edit my message) Actually, I ran it how you did and it 
>> worked fine. But I'm still not sure why it won't run when I use 
>> include("arg.jl").
>>
>>
>> On Thursday, January 7, 2016 at 7:09:47 PM UTC-5, Uthsav Chitra wrote:
>>>
>>> I opened Julia in Terminal, made a file with that text called 'arg.jl', 
>>> and ran
>>>
>>> include("arg.jl").
>>>
>>> On Thursday, January 7, 2016 at 4:34:00 PM UTC-5, Kevin Squire wrote:
>>>>
>>>> Hello Uthsav, 
>>>>
>>>> Works for me:
>>>>
>>>> $ julia0.3 argparse_example3.jl --opt1 1 2 3
>>>> Parsed args:
>>>>   arg1  =>  {"2","3"}
>>>>   karma  =>  0
>>>>   arg2  =>  {"no_arg_given"}
>>>>   opt1  =>  1
>>>>
>>>> How are you trying to run that code?
>>>>
>>>> On Thu, Jan 7, 2016 at 12:36 PM, Uthsav Chitra <uthsav...@brown.edu> 
>>>> wrote:
>>>>
>>>>> I'm using Julia v0.3.9 right now. I recently updated all my packages 
>>>>> (I haven't opened Julia in a couple months), including ArgParse. The 
>>>>> macro 
>>>>> @add_arg_table isn't recognized though. In particular, I tried running 
>>>>> example code here 
>>>>> <https://github.com/carlobaldassi/ArgParse.jl/blob/master/examples/argparse_example3.jl>,
>>>>>  
>>>>> but I get the following error:
>>>>>
>>>>> *ERROR: @add_arg_table not defined*
>>>>>
>>>>> * in include at 
>>>>> /Applications/Julia-0.3.9.app/Contents/Resources/julia/lib/julia/sys.dylib*
>>>>>
>>>>> * in include_from_node1 at 
>>>>> /Applications/Julia-0.3.9.app/Contents/Resources/julia/lib/julia/sys.dylib*
>>>>>
>>>>> *while loading /Users/Uthsav/Desktop/Walking The Interactome 
>>>>> Work/arg.jl, in expression starting on line 42*
>>>>>
>>>>>
>>>>> This is essentially the problem I'm having in my own code. I looked 
>>>>> but couldn't find any information about this besides what it says on the 
>>>>> Github, which is that the macro @add_arg_table should still work. Any 
>>>>> help 
>>>>> would be greatly appreciated. Thanks a lot!
>>>>>
>>>>
>>>>
>

Re: [julia-users] ArgParse @add_arg_table not recognized

2016-01-07 Thread Uthsav Chitra
Sorry! Won't happen again.

On Thursday, January 7, 2016 at 4:38:27 PM UTC-5, Stefan Karpinski wrote:
>
> Please don't cross-post questions on multiple forums: 
> http://stackoverflow.com/questions/34665140/argparse-add-arg-table-not-recognized-in-julia
> .
>
> On Thu, Jan 7, 2016 at 4:33 PM, Kevin Squire <kevin@gmail.com 
> > wrote:
>
>> Hello Uthsav, 
>>
>> Works for me:
>>
>> $ julia0.3 argparse_example3.jl --opt1 1 2 3
>> Parsed args:
>>   arg1  =>  {"2","3"}
>>   karma  =>  0
>>   arg2  =>  {"no_arg_given"}
>>   opt1  =>  1
>>
>> How are you trying to run that code?
>>
>> On Thu, Jan 7, 2016 at 12:36 PM, Uthsav Chitra <uthsav...@brown.edu 
>> > wrote:
>>
>>> I'm using Julia v0.3.9 right now. I recently updated all my packages (I 
>>> haven't opened Julia in a couple months), including ArgParse. The macro 
>>> @add_arg_table isn't recognized though. In particular, I tried running 
>>> example code here 
>>> <https://github.com/carlobaldassi/ArgParse.jl/blob/master/examples/argparse_example3.jl>,
>>>  
>>> but I get the following error:
>>>
>>> *ERROR: @add_arg_table not defined*
>>>
>>> * in include at 
>>> /Applications/Julia-0.3.9.app/Contents/Resources/julia/lib/julia/sys.dylib*
>>>
>>> * in include_from_node1 at 
>>> /Applications/Julia-0.3.9.app/Contents/Resources/julia/lib/julia/sys.dylib*
>>>
>>> *while loading /Users/Uthsav/Desktop/Walking The Interactome 
>>> Work/arg.jl, in expression starting on line 42*
>>>
>>>
>>> This is essentially the problem I'm having in my own code. I looked but 
>>> couldn't find any information about this besides what it says on the 
>>> Github, which is that the macro @add_arg_table should still work. Any help 
>>> would be greatly appreciated. Thanks a lot!
>>>
>>
>>
>

Re: [julia-users] ArgParse @add_arg_table not recognized

2016-01-07 Thread Uthsav Chitra
I opened Julia in Terminal, made a file with that text called 'arg.jl', and 
ran

include("arg.jl").

On Thursday, January 7, 2016 at 4:34:00 PM UTC-5, Kevin Squire wrote:
>
> Hello Uthsav, 
>
> Works for me:
>
> $ julia0.3 argparse_example3.jl --opt1 1 2 3
> Parsed args:
>   arg1  =>  {"2","3"}
>   karma  =>  0
>   arg2  =>  {"no_arg_given"}
>   opt1  =>  1
>
> How are you trying to run that code?
>
> On Thu, Jan 7, 2016 at 12:36 PM, Uthsav Chitra <uthsav...@brown.edu 
> > wrote:
>
>> I'm using Julia v0.3.9 right now. I recently updated all my packages (I 
>> haven't opened Julia in a couple months), including ArgParse. The macro 
>> @add_arg_table isn't recognized though. In particular, I tried running 
>> example code here 
>> <https://github.com/carlobaldassi/ArgParse.jl/blob/master/examples/argparse_example3.jl>,
>>  
>> but I get the following error:
>>
>> *ERROR: @add_arg_table not defined*
>>
>> * in include at 
>> /Applications/Julia-0.3.9.app/Contents/Resources/julia/lib/julia/sys.dylib*
>>
>> * in include_from_node1 at 
>> /Applications/Julia-0.3.9.app/Contents/Resources/julia/lib/julia/sys.dylib*
>>
>> *while loading /Users/Uthsav/Desktop/Walking The Interactome Work/arg.jl, 
>> in expression starting on line 42*
>>
>>
>> This is essentially the problem I'm having in my own code. I looked but 
>> couldn't find any information about this besides what it says on the 
>> Github, which is that the macro @add_arg_table should still work. Any help 
>> would be greatly appreciated. Thanks a lot!
>>
>
>

Re: [julia-users] ArgParse @add_arg_table not recognized

2016-01-07 Thread Uthsav Chitra
(Not sure how to edit my message) Actually, I ran it how you did and it 
worked fine. But I'm still not sure why it won't run when I use 
include("arg.jl").

On Thursday, January 7, 2016 at 7:09:47 PM UTC-5, Uthsav Chitra wrote:
>
> I opened Julia in Terminal, made a file with that text called 'arg.jl', 
> and ran
>
> include("arg.jl").
>
> On Thursday, January 7, 2016 at 4:34:00 PM UTC-5, Kevin Squire wrote:
>>
>> Hello Uthsav, 
>>
>> Works for me:
>>
>> $ julia0.3 argparse_example3.jl --opt1 1 2 3
>> Parsed args:
>>   arg1  =>  {"2","3"}
>>   karma  =>  0
>>   arg2  =>  {"no_arg_given"}
>>   opt1  =>  1
>>
>> How are you trying to run that code?
>>
>> On Thu, Jan 7, 2016 at 12:36 PM, Uthsav Chitra <uthsav...@brown.edu> 
>> wrote:
>>
>>> I'm using Julia v0.3.9 right now. I recently updated all my packages (I 
>>> haven't opened Julia in a couple months), including ArgParse. The macro 
>>> @add_arg_table isn't recognized though. In particular, I tried running 
>>> example code here 
>>> <https://github.com/carlobaldassi/ArgParse.jl/blob/master/examples/argparse_example3.jl>,
>>>  
>>> but I get the following error:
>>>
>>> *ERROR: @add_arg_table not defined*
>>>
>>> * in include at 
>>> /Applications/Julia-0.3.9.app/Contents/Resources/julia/lib/julia/sys.dylib*
>>>
>>> * in include_from_node1 at 
>>> /Applications/Julia-0.3.9.app/Contents/Resources/julia/lib/julia/sys.dylib*
>>>
>>> *while loading /Users/Uthsav/Desktop/Walking The Interactome 
>>> Work/arg.jl, in expression starting on line 42*
>>>
>>>
>>> This is essentially the problem I'm having in my own code. I looked but 
>>> couldn't find any information about this besides what it says on the 
>>> Github, which is that the macro @add_arg_table should still work. Any help 
>>> would be greatly appreciated. Thanks a lot!
>>>
>>
>>

[julia-users] ArgParse @add_arg_table not recognized

2016-01-07 Thread Uthsav Chitra
I'm using Julia v0.3.9 right now. I recently updated all my packages (I 
haven't opened Julia in a couple months), including ArgParse. The macro 
@add_arg_table isn't recognized though. In particular, I tried running 
example code here 
,
 
but I get the following error:

*ERROR: @add_arg_table not defined*

* in include at 
/Applications/Julia-0.3.9.app/Contents/Resources/julia/lib/julia/sys.dylib*

* in include_from_node1 at 
/Applications/Julia-0.3.9.app/Contents/Resources/julia/lib/julia/sys.dylib*

*while loading /Users/Uthsav/Desktop/Walking The Interactome Work/arg.jl, 
in expression starting on line 42*


This is essentially the problem I'm having in my own code. I looked but 
couldn't find any information about this besides what it says on the 
Github, which is that the macro @add_arg_table should still work. Any help 
would be greatly appreciated. Thanks a lot!


[julia-users] Merge partitions

2015-07-21 Thread Uthsav Chitra
Is there any way to merge partitions together? For instance, could I do 
something like merge(partitions(1:n, 2), partitions(1:n, 3))? I essentially 
want to create one iterable object out of both of them.


[julia-users] Parallel for loop over partitions iterator

2015-07-16 Thread Uthsav Chitra
So I'm trying to iterate over the list of partitions of something, say 
`1:n` for some `n` between 13 and 21. The code that I ideally want to run 
looks something like this:

valid_num = @parallel (+) for p in partitions(1:n)
  int(is_valid(p))
end

println(valid_num)

This would use the `@parallel for` to map-reduce my problem. For example, 
compare this to the example in the Julia documentation:

nheads = @parallel (+) for i=1:2
  Int(rand(Bool))
end

However, if I try my adaptation of the loop, I get the following error:

ERROR: `getindex` has no method matching 
getindex(::SetPartitions{UnitRange{Int64}}, ::Int64)
 in anonymous at no file:1433
 in anonymous at multi.jl:1279
 in run_work_thunk at multi.jl:621
 in run_work_thunk at multi.jl:630
 in anonymous at task.jl:6

which I think is because you cannot call `p[3]` if `p=partitions(1:n)`, 
which explains the getindex error.

I've tried using `pmap` to solve my problem, but because the number of 
partitions can get really big, really quickly (there are more than 2.5 
million partitions of `1:13`, and when I get to `1:21` things will be 
huge), constructing such a large array becomes an issue. I left it running 
over night and it still didn't finish.

Does anyone have any advice for how I can efficiently iterate over 
partitions in parallel? I have access to a ~30 core computer and my task 
seems easily parallelizable, so I would be really grateful if anyone knows 
a good way to do this in Julia. 

Thank you so much!