@@ -534,126 +534,6 @@ function find_libcudadevrt(cuda::LocalToolkit)
534
534
end
535
535
536
536
537
- #
538
- # CUDNN
539
- #
540
-
541
- export libcudnn, has_cudnn
542
-
543
- const __libcudnn = Ref {Union{String,Nothing}} ()
544
- function libcudnn (; throw_error:: Bool = true )
545
- path = @initialize_ref __libcudnn begin
546
- # CUDNN depends on CUBLAS
547
- libcublas ()
548
-
549
- find_cudnn (toolkit (), v " 8" )
550
- end CUDA. CUDNN. __runtime_init__ ()
551
- if path === nothing && throw_error
552
- error (" This functionality is unavailabe as CUDNN is missing." )
553
- end
554
- path
555
- end
556
- has_cudnn () = libcudnn (throw_error= false ) != = nothing
557
-
558
- function find_cudnn (cuda:: ArtifactToolkit , version)
559
- artifact_dir = cuda_artifact (" CUDNN" , cuda. release)
560
- if artifact_dir === nothing
561
- return nothing
562
- end
563
- path = artifact_library (artifact_dir, " cudnn" , [version])
564
-
565
- # HACK: eagerly open CUDNN sublibraries to avoid dlopen discoverability issues
566
- for sublibrary in (" ops_infer" , " ops_train" ,
567
- " cnn_infer" , " cnn_train" ,
568
- " adv_infer" , " adv_train" )
569
- sublibrary_path = artifact_library (artifact_dir, " cudnn_$(sublibrary) " , [version])
570
- Libdl. dlopen (sublibrary_path)
571
- end
572
-
573
- @debug " Using CUDNN from an artifact at $(artifact_dir) "
574
- Libdl. dlopen (path)
575
- return path
576
- end
577
-
578
- function find_cudnn (cuda:: LocalToolkit , version)
579
- path = find_library (" cudnn" , [version]; locations= cuda. dirs)
580
- if path === nothing
581
- return nothing
582
- end
583
-
584
- # with a local CUDNN version, we shouldn't need to eagerly open sublibraries,
585
- # as they are expected to be globally discoverable next to libcudnn.so
586
-
587
- @debug " Using local CUDNN at $(path) "
588
- Libdl. dlopen (path)
589
- return path
590
- end
591
-
592
-
593
- #
594
- # CUTENSOR
595
- #
596
-
597
- export libcutensor, libcutensormg, has_cutensor, has_cutensormg
598
-
599
- const __libcutensor = Ref {Union{String,Nothing}} ()
600
- function libcutensor (; throw_error:: Bool = true )
601
- path = @initialize_ref __libcutensor begin
602
- # CUTENSOR depends on CUBLAS
603
- libcublas ()
604
-
605
- find_cutensor (toolkit (), " cutensor" , v " 1" )
606
- end
607
- if path === nothing && throw_error
608
- error (" This functionality is unavailabe as CUTENSOR is missing." )
609
- end
610
- path
611
- end
612
- has_cutensor () = libcutensor (throw_error= false ) != = nothing
613
-
614
- const __libcutensormg = Ref {Union{String,Nothing}} ()
615
- function libcutensormg (; throw_error:: Bool = true )
616
- path = @initialize_ref __libcutensor begin
617
- # CUTENSORMg additionally depends on CUDARt
618
- libcudart ()
619
-
620
- if CUTENSOR. version () < v " 1.4"
621
- nothing
622
- else
623
- find_cutensor (toolkit (), " cutensorMg" , v " 1" )
624
- end
625
- end
626
- if path === nothing && throw_error
627
- error (" This functionality is unavailabe as CUTENSORMg is missing." )
628
- end
629
- path
630
- end
631
- has_cutensormg () = libcutensormg (throw_error= false ) != = nothing
632
-
633
- function find_cutensor (cuda:: ArtifactToolkit , name, version)
634
- artifact_dir = cuda_artifact (" CUTENSOR" , cuda. release)
635
- if artifact_dir === nothing
636
- return nothing
637
- end
638
- path = artifact_library (artifact_dir, name, [version])
639
-
640
- @debug " Using CUTENSOR library $name from an artifact at $(artifact_dir) "
641
- Libdl. dlopen (path)
642
- return path
643
- end
644
-
645
- function find_cutensor (cuda:: LocalToolkit , name, version)
646
- path = find_library (name, [version]; locations= cuda. dirs)
647
- if path === nothing
648
- return nothing
649
- end
650
-
651
- @debug " Using local CUTENSOR library $name at $(path) "
652
- Libdl. dlopen (path)
653
- return path
654
- end
655
-
656
-
657
537
#
658
538
# NCCL
659
539
#
@@ -666,7 +546,7 @@ function libnccl(; throw_error::Bool=true)
666
546
find_nccl (toolkit (), " nccl" , v " 1" )
667
547
end
668
548
if path === nothing && throw_error
669
- error (" This functionality is unavailabe as CUTENSOR is missing." )
549
+ error (" This functionality is unavailabe as NCCL is missing." )
670
550
end
671
551
path
672
552
end
@@ -696,97 +576,6 @@ function find_nccl(cuda::LocalToolkit, name, version)
696
576
end
697
577
698
578
699
- #
700
- # CUQUANTUM
701
- #
702
-
703
- export libcutensornet, has_cutensornet, libcustatevec, has_custatevec
704
-
705
- const __libcutensornet = Ref {Union{String,Nothing}} ()
706
- function libcutensornet (; throw_error:: Bool = true )
707
- path = @initialize_ref __libcutensornet begin
708
- # CUTENSORNET depends on CUTENSOR
709
- libcutensor (throw_error= throw_error)
710
-
711
- if CUDA. runtime_version () < v " 11"
712
- # XXX : bound this using tags in the Artifact.toml?
713
- nothing
714
- else
715
- find_cutensornet (toolkit (), " cutensornet" , v " 0.1.0" )
716
- end
717
- end
718
- if path === nothing && throw_error
719
- error (" This functionality is unavailabe as CUTENSORNET is missing." )
720
- end
721
- return path
722
- end
723
- has_cutensornet () = has_cutensor () && libcutensornet (throw_error= false ) != = nothing
724
-
725
- const __libcustatevec = Ref {Union{String,Nothing}} ()
726
- function libcustatevec (; throw_error:: Bool = true )
727
- path = @initialize_ref __libcustatevec begin
728
-
729
- if CUDA. runtime_version () < v " 11"
730
- # XXX : bound this using tags in the Artifact.toml?
731
- nothing
732
- else
733
- find_custatevec (toolkit (), " custatevec" , v " 0.1.0" )
734
- end
735
- end
736
- if path === nothing && throw_error
737
- error (" This functionality is unavailabe as CUSTATEVEC is missing." )
738
- end
739
- return path
740
- end
741
- has_custatevec () = libcustatevec (throw_error= false ) != = nothing
742
-
743
- function find_cutensornet (cuda:: ArtifactToolkit , name, version)
744
- artifact_dir = generic_artifact (" cuQuantum" )
745
- if artifact_dir === nothing
746
- return nothing
747
- end
748
- path = artifact_library (artifact_dir, name, [version])
749
-
750
- @debug " Using CUTENSORNET library $name from an artifact at $(artifact_dir) "
751
- Libdl. dlopen (path)
752
- return path
753
- end
754
-
755
- function find_cutensornet (cuda:: LocalToolkit , name, version)
756
- path = find_library (name, [version]; locations= cuda. dirs)
757
- if path === nothing
758
- return nothing
759
- end
760
-
761
- @debug " Using local CUTENSORNET library $name at $(path) "
762
- Libdl. dlopen (path)
763
- return path
764
- end
765
-
766
- function find_custatevec (cuda:: ArtifactToolkit , name, version)
767
- artifact_dir = cuda_artifact (" cuQuantum" , v " 0.1.3" )
768
- if artifact_dir === nothing
769
- return nothing
770
- end
771
- path = artifact_library (artifact_dir, name, [version])
772
-
773
- @debug " Using CUSTATEVEC library $name from an artifact at $(artifact_dir) "
774
- Libdl. dlopen (path)
775
- return path
776
- end
777
-
778
- function find_custatevec (cuda:: LocalToolkit , name, version)
779
- path = find_library (name, [version]; locations= cuda. dirs)
780
- if path === nothing
781
- return nothing
782
- end
783
-
784
- @debug " Using local CUSTATEVEC library $name at $(path) "
785
- Libdl. dlopen (path)
786
- return path
787
- end
788
-
789
-
790
579
#
791
580
# Utilities
792
581
#
0 commit comments