Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Display for CuArray within Tuples does not respect :limit=>true #305

Closed
denizyuret opened this issue Jul 20, 2020 · 7 comments
Closed

Display for CuArray within Tuples does not respect :limit=>true #305

denizyuret opened this issue Jul 20, 2020 · 7 comments
Labels
cuda array Stuff about CuArray. enhancement New feature or request needs information Further information is requested

Comments

@denizyuret
Copy link
Contributor

denizyuret commented Jul 20, 2020

Displaying a large CuArray at REPL uses :limit=>true:

julia> a
a
3×20 CuArray{Float32,2}:
 0.170696  0.931874    0.279238  0.935198  …  0.755874  0.25591   0.145203  0.109953
 0.55215   0.730604    0.519178  0.861671     0.606171  0.445813  0.349833  0.0233826
 0.138563  0.00803089  0.343291  0.841917     0.516833  0.642067  0.809235  0.210323

However when the array is in a tuple, this doesn't work, which is an issue with very long arrays (weight matrices in DL models etc):

julia> (a,a)
(Float32[0.17069562 0.9318743 0.27923822 0.93519837 0.17324868 0.8444695 0.23726396 0.442058\
95 0.74674296 0.7105773 0.7555575 0.3766307 0.24607402 0.042451065 0.8920278 0.03008034 0.75\
5874 0.2559098 0.1452031 0.10995314; 0.5521501 0.7306035 0.5191783 0.8616707 0.35620633 0.75\
305074 0.08894424 0.21426299 0.89113736 0.27977893 0.5640254 0.6592203 0.40508494 0.82084036\
 0.120414235 0.5970823 0.6061712 0.445813 0.34983322 0.023382602; 0.13856304 0.0080308905 0.\
3432915 0.8419171 0.78164005 0.9930826 0.66675305 0.22509602 0.76716983 0.12432363 0.3670865\
 0.6387492 0.3793033 0.99525774 0.13459714 0.13978532 0.51683336 0.6420671 0.80923474 0.2103\
2284], Float32[0.17069562 0.9318743 0.27923822 0.93519837 0.17324868 0.8444695 0.23726396 0.\
44205895 0.74674296 0.7105773 0.7555575 0.3766307 0.24607402 0.042451065 0.8920278 0.0300803\
4 0.755874 0.2559098 0.1452031 0.10995314; 0.5521501 0.7306035 0.5191783 0.8616707 0.3562063\
3 0.75305074 0.08894424 0.21426299 0.89113736 0.27977893 0.5640254 0.6592203 0.40508494 0.82\
084036 0.120414235 0.5970823 0.6061712 0.445813 0.34983322 0.023382602; 0.13856304 0.0080308\
905 0.3432915 0.8419171 0.78164005 0.9930826 0.66675305 0.22509602 0.76716983 0.12432363 0.3\
670865 0.6387492 0.3793033 0.99525774 0.13459714 0.13978532 0.51683336 0.6420671 0.80923474 \
0.21032284])
@maleadt maleadt added cuda array Stuff about CuArray. enhancement New feature or request good first issue Good for newcomers labels Jul 22, 2020
@maleadt
Copy link
Member

maleadt commented Jul 27, 2020

Works here?

julia> a = CUDA.rand(3,20)
3×20 CuArray{Float32,2}:
 0.791928  0.193498    0.54177   0.279776  0.792974  0.261743  0.639325  0.642744  0.923863  0.00409899  0.6702    0.563397  0.931436  0.674071  0.208955  0.402524    0.881566  0.917692  0.144188  0.619037
 0.453527  0.905241    0.310285  0.662342  0.81729   0.339216  0.718269  0.036653  0.147669  0.611644    0.893371  0.138585  0.371269  0.113868  0.838266  0.00498096  0.779889  0.257619  0.930623  0.361798
 0.926875  0.00135924  0.387076  0.70094   0.921981  0.354088  0.657477  0.1382    0.971005  0.468556    0.208672  0.819378  0.662434  0.9594    0.590259  0.79262     0.839296  0.597168  0.735627  0.645457

julia> (a,a)
(Float32[0.7919282 0.19349808 … 0.14418846 0.61903703; 0.45352703 0.9052406 … 0.9306232 0.3617978; 0.9268753 0.0013592407 … 0.7356266 0.64545715], Float32[0.7919282 0.19349808 … 0.14418846 0.61903703; 0.45352703 0.9052406 … 0.9306232 0.3617978; 0.9268753 0.0013592407 … 0.7356266 0.64545715])

@maleadt maleadt added needs information Further information is requested and removed good first issue Good for newcomers labels Jul 27, 2020
@maleadt maleadt closed this as completed Jul 30, 2020
@denizyuret
Copy link
Contributor Author

denizyuret commented Jul 30, 2020

You probably have:

julia> Base.active_repl                                                                                                                              
REPL.LineEditREPL(...)

This problem occurs when (e.g. in emacs shell):

julia> Base.active_repl
REPL.BasicREPL(...)

@denizyuret denizyuret reopened this Jul 30, 2020
@maleadt
Copy link
Member

maleadt commented Jul 30, 2020

Still works:

julia> b = CUDA.rand(3,20)
3×20 CuArray{Float32,2}:
 0.754297  0.0199603  0.798279   0.392915   0.429598  0.674418   0.813445  0.109311  0.22639   0.593639  0.336915  0.793389  0.655525  0.855005  0.896946  0.427964  0.404904  0.0128183  0.108465  0.987237
 0.443169  0.576546   0.543805   0.174336   0.23632   0.55431    0.804034  0.117613  0.47366   0.125368  0.54809   0.988693  0.613088  0.455964  0.667325  0.321332  0.251897  0.995712   0.169582  0.429829
 0.619525  0.145502   0.0722919  0.0602679  0.27259   0.0797897  0.853926  0.151283  0.620081  0.891446  0.680025  0.800221  0.241839  0.530185  0.868747  0.538102  0.542841  0.0942091  0.634162  0.190604

julia> (b,b)
(Float32[0.7542968 0.019960323 … 0.10846454 0.98723656; 0.44316876 0.57654643 … 0.1695816 0.42982876; 0.6195254 0.14550208 … 0.6341618 0.19060424], Float32[0.7542968 0.019960323 … 0.10846454 0.98723656; 0.44316876 0.57654643 … 0.1695816 0.42982876; 0.6195254 0.14550208 … 0.6341618 0.19060424])

julia> Base.active_repl
REPL.BasicREPL

@denizyuret
Copy link
Contributor Author

OK, I think I figured it out, I think this only happens in emacs shell because it uses the dumb terminal, try:
TERM=dumb julia

@maleadt
Copy link
Member

maleadt commented Jul 30, 2020

That's exactly what I did to get the BasicREPL, and it still worked properly.

@denizyuret
Copy link
Contributor Author

OK, that's odd. Here is what I get on several linux machines I tried. We could have different linux versions, different julia versions, different startup files, different terminal settings?

 [dyuret@login02 ~]$ TERM=dumb julia --startup-file=no
               _
   _       _ _(_)_     |  Documentation: https://docs.julialang.org
  (_)     | (_) (_)    |
   _ _   _| |_  __ _   |  Type "?" for help, "]?" for Pkg help.
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 1.4.2 (2020-05-23)
 _/ |\__'_|_|_|\__'_|  |  Official https://julialang.org/ release
|__/                   |

┌ Warning: Terminal not fully functional
└ @ Base client.jl:374
julia> using CUDA; a=CUDA.rand(3,20)
3×20 CuArray{Float32,2}:
 0.440498  0.317192  0.616548  0.803562  0.522432  0.592636  0.172601  0.897649  0.993757  0.110087  0.631246  0.568497  0.671344  0.0150986  0.545147  0.525666  0.255196  0.952698  0.502645  0.408362
 0.653669  0.138289  0.481084  0.641261  0.680859  0.798107  0.963335  0.142662  0.73766   0.759891  0.696293  0.788022  0.581208  0.463857   0.186229  0.181144  0.395826  0.778492  0.736891  0.603994
 0.882164  0.529108  0.628779  0.688915  0.322101  0.652743  0.725502  0.531257  0.598296  0.593093  0.659171  0.420074  0.189526  0.767917   0.816833  0.420094  0.692908  0.418647  0.979213  0.305643

julia> (a,a)
(Float32[0.44049796 0.31719223 0.61654776 0.80356175 0.5224319 0.5926363 0.1726006 0.8976493 0.99375695 0.11008705 0.63124573 0.56849694 0.6713437 0.015098605 0.545147 0.5256655 0.25519633 0.9526976 0.5026454 0.40836188; 0.6536687 0.13828856 0.48108393 0.641261 0.6808593 0.7981066 0.9633345 0.1426624 0.7376603 0.75989115 0.6962926 0.7880215 0.58120847 0.46385705 0.1862294 0.18114418 0.39582625 0.77849174 0.7368911 0.6039937; 0.8821635 0.52910846 0.6287788 0.68891495 0.32210135 0.6527432 0.7255016 0.53125703 0.59829587 0.59309286 0.6591711 0.42007425 0.18952629 0.7679174 0.81683266 0.42009404 0.69290787 0.41864702 0.9792127 0.30564347], Float32[0.44049796 0.31719223 0.61654776 0.80356175 0.5224319 0.5926363 0.1726006 0.8976493 0.99375695 0.11008705 0.63124573 0.56849694 0.6713437 0.015098605 0.545147 0.5256655 0.25519633 0.9526976 0.5026454 0.40836188; 0.6536687 0.13828856 0.48108393 0.641261 0.6808593 0.7981066 0.9633345 0.1426624 0.7376603 0.75989115 0.6962926 0.7880215 0.58120847 0.46385705 0.1862294 0.18114418 0.39582625 0.77849174 0.7368911 0.6039937; 0.8821635 0.52910846 0.6287788 0.68891495 0.32210135 0.6527432 0.7255016 0.53125703 0.59829587 0.59309286 0.6591711 0.42007425 0.18952629 0.7679174 0.81683266 0.42009404 0.69290787 0.41864702 0.9792127 0.30564347])

julia> Base.active_repl
REPL.BasicREPL(REPL.Terminals.TTYTerminal("dumb", Base.TTY(RawFD(0x0000000a) paused, 0 bytes waiting), Base.TTY(RawFD(0x0000000d) open, 0 bytes waiting), Base.TTY(RawFD(0x0000000f) open, 0 bytes waiting)), false)

@maleadt
Copy link
Member

maleadt commented Jul 30, 2020

This reproduces on 1.4, where Array has the same behavior though:

$ TERM=dumb julia --startup-file=no                                                                                                                                                                                       
               _
   _       _ _(_)_     |  Documentation: https://docs.julialang.org
  (_)     | (_) (_)    |
   _ _   _| |_  __ _   |  Type "?" for help, "]?" for Pkg help.
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 1.4.2 (2020-05-23)
 _/ |\__'_|_|_|\__'_|  |  Official https://julialang.org/ release
|__/                   |

julia> a = rand(3,20);

julia> (a,a)
([0.2147601064424871 0.9154577909379571 0.4420795116424958 0.7911246201167217 0.48191268864722914 0.8377323674574446 0.8260839000406619 0.07249849079114767 0.07718477918546984 0.09789749216566901 0.2685253050743901 0.4946318022331626 0.8606002413068596 0.3480882135925618 0.6030154895759359 0.7777715697328071 0.4884246045399896 0.8779226464638095 0.850659376374231 0.7592804123548003; 0.4731693149147067 0.5651871566801392 0.5338959350190884 0.14447255510742418 0.028703006490705008 0.27556165079122685 0.22033843195100222 0.33004498069543997 0.7855231022713951 0.4174931406209432 0.8958159815482301 0.33249826726791776 0.6370449401578031 0.47347537951477014 0.3764078347300812 0.4072312495052437 0.27523371881194003 0.8644104655448428 0.0779935716064255 0.09465288661834848; 0.5563584572843856 0.15516019530283587 0.5047427880292956 0.49602062835001903 0.23932827222139474 0.5517268168396903 0.01495751769318665 0.6432473813089961 0.21777914360123662 0.6523027933376073 0.8535692486525215 0.76428671843632 0.5325702280054556 0.11231258413096112 0.4394450683797808 0.004335955588484541 0.25000866173139724 0.4795742171393982 0.2786709232231579 0.020707330343926023], [0.2147601064424871 0.9154577909379571 0.4420795116424958 0.7911246201167217 0.48191268864722914 0.8377323674574446 0.8260839000406619 0.07249849079114767 0.07718477918546984 0.09789749216566901 0.2685253050743901 0.4946318022331626 0.8606002413068596 0.3480882135925618 0.6030154895759359 0.7777715697328071 0.4884246045399896 0.8779226464638095 0.850659376374231 0.7592804123548003; 0.4731693149147067 0.5651871566801392 0.5338959350190884 0.14447255510742418 0.028703006490705008 0.27556165079122685 0.22033843195100222 0.33004498069543997 0.7855231022713951 0.4174931406209432 0.8958159815482301 0.33249826726791776 0.6370449401578031 0.47347537951477014 0.3764078347300812 0.4072312495052437 0.27523371881194003 0.8644104655448428 0.0779935716064255 0.09465288661834848; 0.5563584572843856 0.15516019530283587 0.5047427880292956 0.49602062835001903 0.23932827222139474 0.5517268168396903 0.01495751769318665 0.6432473813089961 0.21777914360123662 0.6523027933376073 0.8535692486525215 0.76428671843632 0.5325702280054556 0.11231258413096112 0.4394450683797808 0.004335955588484541 0.25000866173139724 0.4795742171393982 0.2786709232231579 0.020707330343926023])

@maleadt maleadt closed this as completed Jul 30, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cuda array Stuff about CuArray. enhancement New feature or request needs information Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants