r/Julia
83 subscribers
146 photos
1 file
3.64K links
Part of @r_channels
@reddit2telegram

Broadcasts messages from the Julia programming language subreddit: https://www.reddit.com/r/Julia/

For discussions on Julia language, join @julialang_org
Download Telegram
JulIDE - an IDE for the Julia programming language

Hi all! 



I'd like to share julIDE — a 

modern IDE for Julia built with

Tauri, React, and Rust.



Features:

\- Monaco editor with LSP based on LanguageServer.jl

\- an integrated debugger

\- Revise.jl integration

\- Pluto.jl support

\- Git integration



It's in beta, so bugs expected,

but feedback is very welcome!



GitHub: https://github.com/sinisterMage/JulIde

https://redd.it/1s1b0ev
@r_Julia
Neovim as a main editor

Greetings, I have been working with Julia for a while and it is been a lot of fun. Even though I mostly used it through, once in a while I need to work with neovim,as my preferred editor, and it has not been great. Has anybody ever successfully setup a ide for Julia, I only need proper lsp for formatting and suggestion. Languageservers.jl seems to be a little slow and inconsistent. Also I need to mention that I normally use nix flakes to set up my environment, not sure it is affecting its performance.

https://redd.it/1s6pa2n
@r_Julia
Julia demo to estimate throughput and power of compute engines on Apple Silicon (CPU, GPU and AMX)

I put together a small Julia demo to run the same matrix multiplication across different compute engines on Apple Silicon:

* CPU (LinearAlgebra)
* GPU (Metal.jl)
* AMX (AppleAccelerate)

What’s nice is that the code barely changes — it’s mostly the array type / backend that determines where it runs.

using LinearAlgebra, BenchmarkTools, Metal

N = 16384
A = rand(Float32, N, N); B = rand(Float32, N, N); C = similar(A)

# GPU
a = MtlArray(A); b = MtlArray(B); c = MtlArray(C)
@benchmark mul!($c, $a, $b)

Then:

# CPU
@benchmark mul!($C, $A, $B)

# AMX
using AppleAccelerate
@benchmark mul!($C, $A, $B)

I also looked at power behavior using mactop + a wall meter — which led to some interesting observations about how efficient the different compute engines are.

Full walkthrough here: [https://youtu.be/HX1B0tlODvY?si=7fZ8HzBG7Ya5LrqS](https://youtu.be/HX1B0tlODvY?si=7fZ8HzBG7Ya5LrqS)

Curious if others have experimented with Metal.jl performance vs CPU/AMX

On my Mac Studio M4 Max (40 GPU cores):

**GPU workload:**

\~183W System DC power (177W delta idle)

\~13 TFLOPS compute throughput

**CPU workload:**

\~122W System DC power.

\~1.3 TFLOPS compute throughput

**AMX workload:**

\~ 39W System DC power

\~ 3.9 TFLOPS compute throughput

https://redd.it/1s6wo6p
@r_Julia
KeemenaPreprocessing.jl v0.1.2 (now with subword tokenization)

I just released KeemenaPreprocessing.jl v0.1.2.

`https://github.com/mantzaris/KeemenaPreprocessing.jl`

It is a Julia package for NLP preprocessing and corpus preparation, and now it has first-party subword support through KeemenaSubwords.jl.

What it can do now:

\- standard text preprocessing and corpus preparation

\- word-level and generic tokenization workflows

\- first-party subword tokenization from the same package entry point

\- tokenizer-native subword ids or bundle-reindexed subword vocabularies

\- streaming preprocessing for larger corpora

\- access to subword offsets, masks, token type ids, and metadata

\- subword preprocessing is not limited to tiny in-memory examples, so it fits better into real corpus preparation workflows via streaming


That means it can now serve as a more complete Julia NLP preprocessing pipeline for modern model workflows.

High-level use cases:
\- preparing text corpora for LLM training

\- subword tokenization from the same package entry point

\- streaming preprocessing for larger datasets

\- preserving tokenizer-native ids or rebuilding a corpus vocabulary

\- exposing offsets, masks, and tokenizer metadata

\- still allowing explicit low-level control through `KeemenaSubwords.jl`




https://redd.it/1sityji
@r_Julia
Want to learn julia for free

I want to learn julia for free. I like reading text not watching video. I would prefer exercise which test my knowledge and force me to write code. Please recommend me a source for it.

https://redd.it/1sjmo1t
@r_Julia
Julia, VS Code, and notebook environment recommendations?

Hi, I am coming from using Python + Jupyter Notebook on VS Code.

I've tried Pluto but I did not like that I had to put up a separate localhost browser to run it.

Anyone using Jupyter on VS Code as if you write in Python on Jupyter notebook kernel within VS Code?

If possible, are there any limitations I should be aware of? compared to using Pluto?


I guess I am also open to switching the editor if there is one supporting both Jupyter and Pluto in house.

Thank you!

https://redd.it/1sltbli
@r_Julia
Numerical computing in my pocket
https://redd.it/1spm4g6
@r_Julia
Size of IOBuffer in characters

Hi all,

I have an IOBuffer with some data, and by construction such data are store as a Vector{UInt8}. Now I would like to infer the length of the data in characters. I know that if all the caracters are ASCIII, I can just take buffer.size and that is the total number of character in my buffer. However, when I have UTF-16 character or some other format, I would be overestimating the actual number of characters. I could convert the data into a String and then take its length, but I would be allocating memory, and if possible I would like to avoid it.



Is there some trick I could use achieve my goal?

https://redd.it/1ssg1eq
@r_Julia
[Learning Julia] Short code review for best practice and idiomatic Julia

I'm starting to learn Julia coming from a background in R and a small amount of C++. Is anybody willing to do a short code review so I make sure I'm on the right track with best practice and idiomatic Julia code?


I wrote a [very short module](https://github.com/lawlerem/learning_julia/blob/main/Interval.jl) defining intervals and basic operations such as intersections, unions, and set differences. I don't need a review of actual function logic, just style. One specific thing that I know could be done better is how I'm dealing with EmptyIntervals. My goal is to learn Julia so if any of questions are asking the wrong thing please let me know!

* Is a call to Interval() that returns an EmptyInterval instead of an Interval ok?
* In the definition of e.g. Base.intersect(I::AbstractInterval...) I check if any of the inputs are an EmptyInterval, and if so I return early. I feel like the more idiomatic way to do this is dispatching a different method if there is an EmptyInterval. Is this possible? I have a feeling traits could do this but would be overkill.
* Union, and setdiff are all somewhat type-unstable because they return Vector{Union{Interval, EmptyInterval}}. It seems like having the Union type here is unavoidable due to the nature of the problem. Is this an acceptable place to not have strict type-stability?

I have mostly avoided looking at the pre-existing Intervals.jl because I wanted to struggle through it myself. I did look at how they define empty intervals where they check if the right endpoint is less than the left endpoint. I don't want to use this solution because in my mind empty intervals don't have left or right endpoints. Thanks for your time!

https://redd.it/1stnycb
@r_Julia
Need some help regarding variable scopes

M = construct(A,b,c,z0); # Construct the Tableau
feasiblesolutions = zeros(1,size(M,2)-2)
counter = 0;
pivot
location = 1 size(M,2)-(size(A,1)+1)     # initial pivot location, col1 is the row, col2 is the column. NEED IMPROVEMENTS
                  2 size(M,2)-(size(A,1))
while sum(choose(M)) != 0   # Since choose(M) is setup so that it outputs (0,0) when no more viable entering variables are present
    for i = 1:size(A,1)     # updates pivotlocation each iteration
        if choose(M)[1] == pivot
locationi,1
            global pivotlocation[i,2] = choose(M)[2]
        end
    end


    global M = pivot(M, choose(M)) # this condition repeats the pivot operations until there are no more valid pivots


    for i = 1:size(A,1)
        local feasible
solutions1,pivot_location[i,2] = Mpivot_location[i,1,end]      # updating feasible solutions
    end
    global counter = counter + 1;
    println(pivotlocation);
    println(counter, " ", feasible
solutions);
end

I wrote some code like so (it's terrible), and I would like the vector feasible_solutions to "reset" after every iteration of the while loop, as in it would return to the global assignment of a zero vector before the loop. I think it has something to do with variable scopes but I can't wrap my head around it after reading some documentation.

https://redd.it/1sx9ubr
@r_Julia
Color code change in VSCodium with Julia extension after update?

VSCodium just updated to version 1.116.02821 on my PC, and I noticed the color code of text displayed in *.jl files is different (and more difficult to read for me) as soon as it loaded and showed the notification. Running Julia code seems to work, but I haven’t tested extensively yet. Julia is the only language I use in VSCodium, so unfortunately I’m not sure if this issue is actually specific to Julia or not.

Did the update break something about the Julia language extension? Did they just change the color code? Does anyone else have this issue?

https://redd.it/1sxmz6a
@r_Julia
Sublime for Julia?

Hey, I just started learning julia and already know python. I have always preferred Sublime over VScode. Kindly give you guys' recommendations? Thanks

https://redd.it/1t3jjpu
@r_Julia
Gym.jl - Gymnasium RL Environments in Julia

Hello everyone!

I've re-implemented some of the Gymnasium RL environments in Julia. As you might expect, they're much faster than the original ones!

https://i.redd.it/80um01qa1bzg1.gif

If you want to take a look at the code, here's the GitHub repository: https://github.com/scascino4/Gym.jl

I hope you'll find them useful!

https://redd.it/1t4cqks
@r_Julia
Learning Julia and the chapter about scoping in the docsgave me pause

What happened there ? Everything before was elegant enough. But complexity in how scoping is presented feels leaky and inelegant. I don't know, still wrapping my mind around it. Compared to how closure is effortless in Scheme in comparison this feels like too much cognitive load, and worse is I don't see the point for it yet. Is it for performance reasons ?

https://redd.it/1tbizp6
@r_Julia