@@ -20,7 +20,7 @@ using ForwardDiff
2020using Aqua
2121using Statistics
2222using LinearAlgebra
23- using InlineStrings
23+ using MPI
2424
2525using Enzyme_jll
2626@info " Testing against" Enzyme_jll. libEnzyme
@@ -236,7 +236,7 @@ make3() = (1.0, 2.0, 3.0)
236236 test_scalar (x-> rem (x, 1 ), 0.7 )
237237 test_scalar (x-> rem2pi (x,RoundDown), 0.7 )
238238 test_scalar (x-> fma (x,x+ 1 ,x/ 3 ), 2.3 )
239-
239+
240240 @test autodiff (Forward, sincos, Duplicated (1.0 , 1.0 ))[1 ][1 ] ≈ cos (1.0 )
241241
242242 @test autodiff (Reverse, (x)-> log (x), Active (2.0 )) == ((0.5 ,),)
588588
589589 bias = Float32[0.0 ;;;]
590590 res = Enzyme. autodiff (Reverse, f, Active, Active (x[1 ]), Const (bias))
591-
591+
592592 @test bias[1 ][1 ] ≈ 0.0
593593 @test res[1 ][1 ] ≈ cos (x[1 ])
594594end
931931
932932@inline function myquantile (v:: AbstractVector , p:: Real ; alpha)
933933 n = length (v)
934-
934+
935935 m = 1.0 + p * (1.0 - alpha - 1.0 )
936936 aleph = n* p + oftype (p, m)
937937 j = clamp (trunc (Int, aleph), 1 , n- 1 )
944944 a = @inbounds v[j]
945945 b = @inbounds v[j + 1 ]
946946 end
947-
947+
948948 return a + γ* (b- a)
949949end
950950
@@ -1166,18 +1166,18 @@ end
11661166 @test 1.0 ≈ Enzyme. autodiff (Forward, inactive_gen, Duplicated (1E4 , 1.0 ))[1 ]
11671167
11681168 function whocallsmorethan30args (R)
1169- temp = diag (R)
1170- R_inv = [temp[1 ] 0. 0. 0. 0. 0. ;
1171- 0. temp[2 ] 0. 0. 0. 0. ;
1172- 0. 0. temp[3 ] 0. 0. 0. ;
1173- 0. 0. 0. temp[4 ] 0. 0. ;
1174- 0. 0. 0. 0. temp[5 ] 0. ;
1169+ temp = diag (R)
1170+ R_inv = [temp[1 ] 0. 0. 0. 0. 0. ;
1171+ 0. temp[2 ] 0. 0. 0. 0. ;
1172+ 0. 0. temp[3 ] 0. 0. 0. ;
1173+ 0. 0. 0. temp[4 ] 0. 0. ;
1174+ 0. 0. 0. 0. temp[5 ] 0. ;
11751175 ]
1176-
1176+
11771177 return sum (R_inv)
11781178 end
1179-
1180- R = zeros (6 ,6 )
1179+
1180+ R = zeros (6 ,6 )
11811181 dR = zeros (6 , 6 )
11821182 autodiff (Reverse, whocallsmorethan30args, Active, Duplicated (R, dR))
11831183
@@ -1845,7 +1845,7 @@ end
18451845 end
18461846 # TODO : Add test for NoShadowException
18471847end
1848-
1848+
18491849function indirectfltret (a):: DataType
18501850 a[] *= 2
18511851 return Float64
@@ -2313,7 +2313,7 @@ end
23132313 Enzyme. API. runtimeActivity! (false )
23142314 @test res[1 ] ≈ 0.2
23152315 # broken as the return of an apply generic is {primal, primal}
2316- # but since the return is abstractfloat doing the
2316+ # but since the return is abstractfloat doing the
23172317 @static if VERSION ≥ v " 1.9-" && ! (VERSION ≥ v " 1.10-" )
23182318 @test_broken res[2 ] ≈ 1.0
23192319 else
@@ -2383,6 +2383,16 @@ end
23832383 )
23842384 @test ad_eta[1 ] ≈ 0.0
23852385end
2386+ @testset " MPI" begin
2387+ testdir = @__DIR__
2388+ # Test parsing
2389+ include (" mpi.jl" )
2390+ mpiexec () do cmd
2391+ run (` $cmd -n 2 $(Base. julia_cmd ()) --project=$testdir $testdir /mpi.jl` )
2392+ end
2393+ @test true
2394+ end
2395+
23862396
23872397@testset " Tape Width" begin
23882398 struct Roo
@@ -2452,10 +2462,10 @@ end
24522462 Duplicated (inters, dinters),
24532463 )
24542464
2455- @test dinters[1 ]. k ≈ 0.1
2456- @test dinters[1 ]. t0 ≈ 1.0
2457- @test dinters[2 ]. k ≈ 0.3
2458- @test dinters[2 ]. t0 ≈ 2.0
2465+ @test dinters[1 ]. k ≈ 0.1
2466+ @test dinters[1 ]. t0 ≈ 1.0
2467+ @test dinters[2 ]. k ≈ 0.3
2468+ @test dinters[2 ]. t0 ≈ 2.0
24592469end
24602470
24612471@testset " Statistics" begin
@@ -2524,7 +2534,7 @@ end
25242534 y = A \ b
25252535 @test dA ≈ (- z * transpose (y))
25262536 @test db ≈ z
2527-
2537+
25282538 db = zero (b)
25292539
25302540 forward, pullback = Enzyme. autodiff_thunk (ReverseSplitNoPrimal, Const{typeof (\ )}, Duplicated, Const{typeof (A)}, Duplicated{typeof (b)})
@@ -2540,7 +2550,7 @@ end
25402550
25412551 y = A \ b
25422552 @test db ≈ z
2543-
2553+
25442554 dA = zero (A)
25452555
25462556 forward, pullback = Enzyme. autodiff_thunk (ReverseSplitNoPrimal, Const{typeof (\ )}, Duplicated, Duplicated{typeof (A)}, Const{typeof (b)})
0 commit comments