File: CMakeLists.txt

package info (click to toggle)
ectrans 1.7.0-5
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 4,972 kB
  • sloc: f90: 51,064; ansic: 5,942; cpp: 1,112; python: 488; sh: 127; makefile: 43
file content (559 lines) | stat: -rw-r--r-- 20,851 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
# (C) Copyright 2020- ECMWF.
#
# This software is licensed under the terms of the Apache Licence Version 2.0
# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
# In applying this licence, ECMWF does not waive the privileges and immunities
# granted to it by virtue of its status as an intergovernmental organisation
# nor does it submit to any jurisdiction.

# --------------------------------------------------------------------------------------------------
# Add a test for installation of ecTrans
# --------------------------------------------------------------------------------------------------

configure_file( test-install.sh.in ${CMAKE_CURRENT_BINARY_DIR}/test-install.sh @ONLY )

unset( _test_args )
if( CMAKE_TOOLCHAIN_FILE )
  list( APPEND _test_args "-DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE}" )
endif()
foreach( lang C CXX Fortran )
  if( CMAKE_${lang}_COMPILER )
    list( APPEND _test_args "-DCMAKE_${lang}_COMPILER=${CMAKE_${lang}_COMPILER}" )
  endif()
endforeach()
foreach( lang C CXX Fortran )
  if( CMAKE_${lang}_FLAGS )
    list( APPEND _test_args "-DCMAKE_${lang}_FLAGS=${CMAKE_${lang}_FLAGS}" )
  endif()
endforeach()
if( CMAKE_EXE_LINKER_FLAGS )
  list( APPEND _test_args "-DCMAKE_EXE_LINKER_FLAGS=${CMAKE_EXE_LINKER_FLAGS}" )
endif()
if( NOT HAVE_DOUBLE_PRECISION )
  list( APPEND _test_args "-DCOMPONENTS=single" )
endif()

add_test( NAME ectrans_test_install
          COMMAND ${CMAKE_CURRENT_BINARY_DIR}/test-install.sh ${_test_args} )

# --------------------------------------------------------------------------------------------------
# Add a test for SETUP_TRANS0
# --------------------------------------------------------------------------------------------------

ecbuild_add_executable(
  TARGET  ectrans_test_setup_trans0
  SOURCES trans/test_setup_trans0.F90
  LIBS    ectrans_common
  LINKER_LANGUAGE Fortran
  NOINSTALL)
set( ntasks 0 )
if( HAVE_MPI )
  list( APPEND ntasks 1 2 )
endif()
foreach( mpi ${ntasks} )
    ecbuild_add_test( TARGET ectrans_test_setup_trans0_mpi${mpi}
        COMMAND ectrans_test_setup_trans0
        MPI ${mpi}
    )
endforeach()

# --------------------------------------------------------------------------------------------------
# Add a test for tangent-linear/adjoint correspondence of INV_TRANS and DIR_TRANS combined (CPU
# version only)
# --------------------------------------------------------------------------------------------------

if( HAVE_CPU )
  set( precisions "" )
  if( HAVE_DOUBLE_PRECISION )
    list( APPEND precisions "dp" )
  endif()
  if( HAVE_SINGLE_PRECISION )
    list( APPEND precisions "sp" )
  endif()

  set( ntasks 0 )
  if( HAVE_MPI )
    list( APPEND ntasks 1 2 )
  endif()

  foreach( precision ${precisions} )
    foreach( mpi ${ntasks} )
      set( test_name ectrans_test_adjoint_mpi${mpi}_${precision} )
      ecbuild_add_test(TARGET ${test_name}
        SOURCES trans/test_adjoint.F90
        LIBS trans_${precision} parkind_${precision}
        LINKER_LANGUAGE Fortran
        MPI ${mpi}
      )
      if( TEST ${test_name} AND HAVE_OMP )
        target_link_libraries( ${test_name} OpenMP::OpenMP_Fortran )
      endif()
    endforeach()
  endforeach()
endif()

# --------------------------------------------------------------------------------------------------
# Add tests for tangent-linear/adjoint correspondence of INV_TRANS and DIR_TRANS
# --------------------------------------------------------------------------------------------------

set( platforms )
if( HAVE_CPU )
  list( APPEND platforms cpu )
endif()
if( HAVE_GPU )
  list( APPEND platforms gpu )
endif()

foreach( platform ${platforms} )
  
  if( "${platform}" MATCHES "cpu" )
    set( platform_tag "" )
  endif()
  if( "${platform}" MATCHES "gpu" )
    set( platform_tag "_gpu" )
  endif()
  
  if( HAVE_DOUBLE_PRECISION )
    set( trans trans${platform_tag}_dp )
    set( parkind parkind_dp )
  else()
    set( trans trans${platform_tag}_sp )
    set( parkind parkind_sp )
  endif()

  set( ntasks 0 )
  if( HAVE_MPI )
    list( APPEND ntasks 1 2 )
  endif()

  foreach( mpi ${ntasks} )
    ecbuild_add_test(TARGET ectrans_test_dirtrans_adjoint_${platform}_mpi${mpi}
      SOURCES trans/test_dirtrans_adjoint.F90
      LIBS ${trans} ${parkind}
      LINKER_LANGUAGE Fortran
      MPI ${mpi}
      OMP 1
    )
    if( TEST ectrans_test_dirtrans_adjoint_${platform}_mpi${mpi} AND HAVE_OMP )
      target_link_libraries( ectrans_test_dirtrans_adjoint_${platform}_mpi${mpi} OpenMP::OpenMP_Fortran )
    endif()
    set_tests_properties(ectrans_test_dirtrans_adjoint_${platform}_mpi${mpi} PROPERTIES LABELS "${platform};Fortran")

    ecbuild_add_test(TARGET ectrans_test_invtrans_adjoint_${platform}_mpi${mpi}
      SOURCES trans/test_invtrans_adjoint.F90
      LIBS ${trans} ${parkind}
      LINKER_LANGUAGE Fortran
      MPI ${mpi}
      OMP 1
    )
    if( TEST ectrans_test_invtrans_adjoint_${platform}_mpi${mpi} AND HAVE_OMP )
      target_link_libraries( ectrans_test_invtrans_adjoint_${platform}_mpi${mpi} OpenMP::OpenMP_Fortran )
    endif()
    set_tests_properties(ectrans_test_invtrans_adjoint_${platform}_mpi${mpi} PROPERTIES LABELS "${platform};Fortran")
    
  endforeach() # mpi comm size

endforeach() # platform

# --------------------------------------------------------------------------------------------------
# Add a test for tangent-linear/adjoint correspondence of GPNORM_TRANSTL/AD (CPU version only)
# --------------------------------------------------------------------------------------------------

if( HAVE_CPU )
  set( precisions "" )
  if( HAVE_DOUBLE_PRECISION )
    list( APPEND precisions "dp" )
  endif()
  if( HAVE_SINGLE_PRECISION )
    list( APPEND precisions "sp" )
  endif()

  set( ntasks 0 )
  if( HAVE_MPI )
    list( APPEND ntasks 1 2 )
  endif()

  foreach( precision ${precisions} )
    foreach( mpi ${ntasks} )
      set( test_name ectrans_test_gpnorm_trans_adjoint_mpi${mpi}_${precision} )
      ecbuild_add_test(TARGET ${test_name}
        SOURCES trans/test_gpnorm_adjoint.F90
        LIBS trans_${precision} parkind_${precision}
        LINKER_LANGUAGE Fortran
        MPI ${mpi}
      )
      if( TEST ${test_name} AND HAVE_OMP )
        target_link_libraries( ${test_name} OpenMP::OpenMP_Fortran )
      endif()
    endforeach()
  endforeach()
endif()

# --------------------------------------------------------------------------------------------------
# Add tests for common call patterns of ecTrans, using the benchmark program
# This tests CPU and/or GPU versions, depending on which are enabled
# --------------------------------------------------------------------------------------------------

macro(ectrans_set_test_properties target)
  if( "${target}" MATCHES "gpu" )
    set_tests_properties(${target} PROPERTIES LABELS "gpu;Fortran")
  endif()
  set_tests_properties( ${target} PROPERTIES FIXTURES_SETUP checksum_tests )
endmacro()

# Determine which benchmarks are available
set( benchmarks "" )
if( TARGET ectrans-benchmark-cpu-dp )
  list( APPEND benchmarks ectrans-benchmark-cpu-dp )
endif()
if( TARGET ectrans-benchmark-cpu-sp )
  list( APPEND benchmarks ectrans-benchmark-cpu-sp )
endif()
if( TARGET ectrans-benchmark-gpu-dp )
  list( APPEND benchmarks ectrans-benchmark-gpu-dp )
endif()
if( TARGET ectrans-benchmark-gpu-sp )
  list( APPEND benchmarks ectrans-benchmark-gpu-sp )
endif()

foreach( benchmark ${benchmarks} )
  # Establish which task/thread parameters to test
  set( ntasks 0 )
  set( nthreads 1 )
  if( HAVE_MPI )
    list( APPEND ntasks 1 2 )
  endif()
  if( ${benchmark} MATCHES "cpu" )
    if( HAVE_OMP )
      list( APPEND nthreads 8 )
    endif()
  endif()

  if( NOT TEST compare_checksums AND (HAVE_MPI OR HAVE_OMP) )
    configure_file( compare_checksums.py ${CMAKE_CURRENT_BINARY_DIR}/compare_checksums.py @ONLY )
    list( JOIN ntasks "," ntasks_joined )
    list( JOIN nthreads "," nthreads_joined )
    ecbuild_add_test( TARGET compare_checksums
      COMMAND "${CMAKE_CURRENT_BINARY_DIR}/compare_checksums.py"
      ARGS "." ${ntasks_joined} ${nthreads_joined}
    )
    set_tests_properties( compare_checksums PROPERTIES FIXTURES_REQUIRED checksum_tests )
  endif()

  # Add test for each parameter combination
  foreach( mpi ${ntasks} )
    foreach( omp ${nthreads} )
      # TCO47 truncation
      set( t 47 )
      set( grid O48 )

      # Base arguments -> 2 iterations, memory consumption/pinning information, spectral norms, and
      # verbose output
      set( base_args --niter 2 --meminfo --norms -v )

      foreach( callmode 1 2 )
        set (base_title "${benchmark}_T${t}_${grid}_mpi${mpi}_omp${omp}_callmode${callmode}")
        # Check it works with 0 3D scalar fields
        ecbuild_add_test( TARGET ${base_title}_nfld0
            COMMAND ${benchmark}
            ARGS --truncation ${t} --grid ${grid} --nfld 0 --check 100 --callmode ${callmode} --dump-checksums ${base_title}_nfld0 ${base_args}
            MPI ${mpi}
            OMP ${omp}
        )
        ectrans_set_test_properties( ${base_title}_nfld0 )

        # Check it works with 10 3D scalar fields and 20 levels
        ecbuild_add_test( TARGET ${base_title}_nfld10_nlev20
            COMMAND ${benchmark}
            ARGS --truncation ${t} --grid ${grid} --nfld 10 --nlev 20 --check 100 --callmode ${callmode} --dump-checksums ${base_title}_nfld10_nlev20 ${base_args}
            MPI ${mpi}
            OMP ${omp}
        )
        ectrans_set_test_properties( ${base_title}_nfld10_nlev20 )

        # Check it works with 10 3D scalar fields, 20 levels, and derivatives
        ecbuild_add_test( TARGET ${base_title}_nfld10_nlev20_derivatives
            COMMAND ${benchmark}
            ARGS --truncation ${t} --grid ${grid} --nfld 10 --nlev 20 --scders --uvders --check 100 --callmode ${callmode} --dump-checksums ${base_title}_nfld10_nlev20_derivatives ${base_args}
            MPI ${mpi}
            OMP ${omp}
        )
        ectrans_set_test_properties( ${base_title}_nfld10_nlev20_derivatives )

        # Check it works with 10 3D scalar fields, 20 levels, and vordiv in grid point space
        ecbuild_add_test( TARGET ${base_title}_nfld10_nlev20_vordiv
            COMMAND ${benchmark}
            ARGS --truncation ${t} --grid ${grid} --nfld 10 --nlev 20 --vordiv --check 100  --callmode ${callmode} --dump-checksums ${base_title}_nfld10_nlev20_vordiv ${base_args}
            MPI ${mpi}
            OMP ${omp}
        )
        ectrans_set_test_properties( ${base_title}_nfld10_nlev20_vordiv )

        # Check it works with 10 3D scalar fields, 20 levels, and NPROMA=16
        ecbuild_add_test( TARGET ${base_title}_nfld10_nlev20_nproma16
            COMMAND ${benchmark}
            ARGS --truncation ${t} --grid ${grid} --nfld 10 --nlev 20 --nproma 16 --check 100 --callmode ${callmode} --dump-checksums ${base_title}_nfld10_nlev20_vordiv_uvders ${base_args}
            MPI ${mpi}
            OMP ${omp}
        )
        ectrans_set_test_properties( ${base_title}_nfld10_nlev20_nproma16 )

        # Check it works with 10 3D scalar fields, 20 levels, and NPROMATR=20 (feature only works for CPU)
        if( ${benchmark} MATCHES "cpu" AND ${callmode} MATCHES "1" )
          ecbuild_add_test( TARGET ${base_title}_nfld10_nlev20_npromatr20
              COMMAND ${benchmark}
              ARGS --truncation ${t} --grid ${grid} --nfld 10 --nlev 20 --npromatr 20 --check 100 --callmode ${callmode} --dump-checksums ${base_title}_nfld10_nlev20_vordiv_uvders ${base_args}
              MPI ${mpi}
              OMP ${omp}
          )
          ectrans_set_test_properties( ${base_title}_nfld10_nlev20_npromatr20 )
        endif()

        if( ${benchmark} MATCHES "cpu" )
          # Check it works with 10 3D scalar fields, 20 levels, and the fast Legendre tranform (CPU only)
          # TODO: Find out why the FLT gives so much higher errors
          ecbuild_add_test( TARGET ${base_title}_nfld10_nlev20_flt
              COMMAND ${benchmark}
              ARGS --truncation ${t} --grid ${grid} --nfld 10 --nlev 20 --flt --check 1000000 --callmode ${callmode} --dump-checksums ${base_title}_nfld10_nlev20_flt ${base_args}
              MPI ${mpi}
              OMP ${omp}
          )
          ectrans_set_test_properties( ${base_title}_nfld10_nlev20 )
        endif()
      endforeach()
    endforeach()
  endforeach()
endforeach()

# --------------------------------------------------------------------------------------------------
# Add tests for common call patterns of ecTrans LAM benchmark (i.e. etrans), using the benchmark
# program
# --------------------------------------------------------------------------------------------------

if( HAVE_ETRANS )
  # Set resolution
  set( nlon 48 )
  set( nlat 40 )

  foreach( prec dp sp )
    if( TARGET ectrans-lam-benchmark-cpu-${prec} )
      set( ntasks 0 )
      set( nthreads 1 )
      if( HAVE_MPI )
        list( APPEND ntasks 1 2 )
      endif()
      if( HAVE_OMP )
        list( APPEND nthreads 8 )
      endif()

      # Base arguments -> nlat x nlon, 2 iterations, memory consumption/pinning information,
      # spectral norms, and verbose output
      set( base_args --nlon ${nlon} --nlat ${nlat} --niter 2 --meminfo --norms -v )

      foreach( mpi ${ntasks} )
        foreach( omp ${nthreads} )
          set(base_title "ectrans_lam_test_benchmark_${prec}_${nlon}x${nlat}_mpi${mpi}_omp${omp}" )

          ecbuild_add_test( TARGET ${base_title}_nfld0
              COMMAND ectrans-lam-benchmark-cpu-${prec} ARGS ${base_args} --nfld 0 --dump-checksums ${base_title}_nfld0
              MPI ${mpi}
              OMP ${omp}
          )
          ectrans_set_test_properties( ${base_title}_nfld0 )

          ecbuild_add_test( TARGET ${base_title}_nfld10
              COMMAND ectrans-lam-benchmark-cpu-${prec} ARGS ${base_args} --nfld 10 --dump-checksums ${base_title}_nfld10
              MPI ${mpi}
              OMP ${omp}
          )
          ectrans_set_test_properties( ${base_title}_nfld10 )

          ecbuild_add_test( TARGET ${base_title}_nfld10_nlev20
              COMMAND ectrans-lam-benchmark-cpu-${prec} ARGS ${base_args} --nfld 10 --nlev 20 --dump-checksums ${base_title}_nfld20
              MPI ${mpi}
              OMP ${omp}
          )
          ectrans_set_test_properties( ${base_title}_nfld10_nlev20 )

          ecbuild_add_test( TARGET ${base_title}_nfld10_nlev20_scders
              COMMAND ectrans-lam-benchmark-cpu-${prec} ARGS ${base_args} --nfld 10 --nlev 20 --scders --dump-checksums ${base_title}_nfld10_nlev20_scders
              MPI ${mpi}
              OMP ${omp}
          )
          ectrans_set_test_properties(  ${base_title}_nfld10_nlev20_scders )

          ecbuild_add_test( TARGET ${base_title}_nfld10_nlev20_vordiv
              COMMAND ectrans-lam-benchmark-cpu-${prec} ARGS ${base_args} --nfld 10 --nlev 20 --vordiv --dump-checksums ${base_title}_nfld10_nlev20_vordiv
              MPI ${mpi}
              OMP ${omp}
          )
          ectrans_set_test_properties( ${base_title}_nfld10_nlev20_vordiv )

          ecbuild_add_test( TARGET ${base_title}_nfld10_nlev20_vordiv_uvders
              COMMAND ectrans-lam-benchmark-cpu-${prec} ARGS ${base_args} --nfld 10 --nlev 20 --vordiv --uvders --dump-checksums ${base_title}_nfld10_nlev20_vordiv_uvders
              MPI ${mpi}
              OMP ${omp}
          )
          ectrans_set_test_properties( ${base_title}_nfld10_nlev20_vordiv_uvders )

          ecbuild_add_test( TARGET ${base_title}_nfld10_nlev20_nproma16
              COMMAND ectrans-lam-benchmark-cpu-${prec} ARGS ${base_args} --nfld 10 --nlev 20 --nproma 16 --dump-checksums ${base_title}_nfld10_nlev20_nproma16
              MPI ${mpi}
              OMP ${omp}
          )
          ectrans_set_test_properties( ${base_title}_nfld10_nlev20_nproma16 )
        endforeach()
      endforeach()
    endif()
  endforeach()

endif()

# --------------------------------------------------------------------------------------------------
# Add tests for transi
# --------------------------------------------------------------------------------------------------

if( HAVE_TRANSI )
  check_include_files( malloc.h       EC_HAVE_MALLOC_H      )
  ecbuild_debug_var( EC_HAVE_MALLOC_H )

  if( EC_HAVE_MALLOC_H )
    list( APPEND  TEST_DEFINITIONS
      TRANSI_HAVE_MEMORY
    )
  else()
    ecbuild_warn( "ectrans tests checking memory leaks are disabled as malloc.h was not found" )
  endif()

  find_package( CMath )
  ecbuild_add_library( TARGET ectrans_test
    VERSION     0d
    SOURCES     transi/transi_test.h transi/transi_test.c
    PUBLIC_LIBS transi_dp ${CMATH_LIBRARIES}
    NOINSTALL
  )
  target_compile_definitions( ectrans_test PUBLIC ${TEST_DEFINITIONS} )

  if( HAVE_GPU )
    ecbuild_add_library( TARGET ectrans_test_gpu
      SOURCES     transi/transi_test.h transi/transi_test.c
      PUBLIC_LIBS transi_gpu_dp
      NOINSTALL
    )
    target_compile_definitions( ectrans_test PUBLIC ${TEST_DEFINITIONS} )
  endif()

  ecbuild_add_test( TARGET ectrans_test_transi_program
    SOURCES   transi/transi_test_program.c
    LIBS      ectrans_test
    LINKER_LANGUAGE C
    ENVIRONMENT TRANS_USE_MPI=0 )

  if( HAVE_GPU )
    ecbuild_add_test( TARGET ectrans_test_transi_program_gpu
      SOURCES   transi/transi_test_program.c
      LIBS      ectrans_test_gpu
      LINKER_LANGUAGE C
      DEFINITIONS GPU_VERSION
      ENVIRONMENT TRANS_USE_MPI=0 )
    set_tests_properties(ectrans_test_transi_program_gpu PROPERTIES LABELS gpu)
    
    ecbuild_add_test( TARGET ectrans_test_transi_invtrans_adjoint_gpu
      SOURCES   transi/transi_test_invtrans_adjoint.c
      LIBS      ectrans_test_gpu
      LINKER_LANGUAGE C
      DEFINITIONS GPU_VERSION
      ENVIRONMENT TRANS_USE_MPI=0 )
    set_tests_properties(ectrans_test_transi_invtrans_adjoint_gpu PROPERTIES LABELS gpu)

    ecbuild_add_test( TARGET ectrans_test_transi_dirtrans_adjoint_gpu
      SOURCES   transi/transi_test_dirtrans_adjoint.c
      LIBS      ectrans_test_gpu
      LINKER_LANGUAGE C
      DEFINITIONS GPU_VERSION
      ENVIRONMENT TRANS_USE_MPI=0 )
    set_tests_properties(ectrans_test_transi_dirtrans_adjoint_gpu PROPERTIES LABELS gpu)
  endif()

  ecbuild_add_test( TARGET ectrans_test_transi_timings
    SOURCES   transi/transi_test_timings.c
    LIBS      ectrans_test
    LINKER_LANGUAGE C
    ENVIRONMENT TRANS_USE_MPI=0 )

  ecbuild_add_test( TARGET ectrans_test_transi_lonlat
    SOURCES   transi/transi_test_lonlat.c
    LIBS      ectrans_test
    LINKER_LANGUAGE C
    ENVIRONMENT TRANS_USE_MPI=0 )

  ecbuild_add_test( TARGET ectrans_test_transi_io
    SOURCES   transi/transi_test_io.c
    LIBS      ectrans_test
    LINKER_LANGUAGE C
    ENVIRONMENT TRANS_USE_MPI=0 )

  ecbuild_add_test( TARGET ectrans_test_transi_memory
    SOURCES   transi/transi_test_memory.c
    LIBS      ectrans_test
    CONDITION EC_HAVE_MALLOC_H
    LINKER_LANGUAGE C
    ENVIRONMENT TRANS_USE_MPI=0 )

  ecbuild_add_test( TARGET ectrans_test_transi_memory_lonlat
    SOURCES   transi/transi_test_memory_lonlat.c
    LIBS      ectrans_test
    CONDITION EC_HAVE_MALLOC_H
    LINKER_LANGUAGE C
    ENVIRONMENT TRANS_USE_MPI=0 )

  ecbuild_add_test( TARGET ectrans_test_transi_vordiv_to_UV
    SOURCES   transi/transi_test_vordiv_to_UV.c
    LIBS      ectrans_test
    LINKER_LANGUAGE C
    ENVIRONMENT TRANS_USE_MPI=0 )

  ecbuild_add_test( TARGET ectrans_test_transi_dirtrans_adjoint
    SOURCES   transi/transi_test_dirtrans_adjoint.c
    LIBS      ectrans_test
    LINKER_LANGUAGE C
    ENVIRONMENT TRANS_USE_MPI=0 )

  ecbuild_add_test( TARGET ectrans_test_transi_invtrans_adjoint
    SOURCES   transi/transi_test_invtrans_adjoint.c
    LIBS      ectrans_test
    LINKER_LANGUAGE C
    ENVIRONMENT TRANS_USE_MPI=0 )

  ecbuild_add_test( TARGET ectrans_test_transi_lonlat_diff_incr
    SOURCES   transi/transi_test_lonlat_diff_incr.c
    LIBS      ectrans_test
    LINKER_LANGUAGE C
    ENVIRONMENT TRANS_USE_MPI=0 )

  ecbuild_add_option( FEATURE MEMORY_TESTS DEFAULT ON DESCRIPTION "Enable memory tests" )
  if( NOT HAVE_MEMORY_TESTS )
    set_tests_properties( ectrans_test_transi_memory ectrans_test_transi_memory_lonlat PROPERTIES DISABLED ON )
  endif()

  ecbuild_add_test( TARGET ectrans_test_transi_lam
    SOURCES   transi/transi_test_lam.c
    LIBS      ectrans_test
    LINKER_LANGUAGE C
    CONDITION HAVE_ETRANS
    ENVIRONMENT TRANS_USE_MPI=0 )

  ecbuild_add_test( TARGET ectrans_test_transi_lam_dirtrans_adjoint
    SOURCES   transi/transi_test_lam_dirtrans_adjoint.c
    LIBS      ectrans_test
    LINKER_LANGUAGE C
    CONDITION HAVE_ETRANS
    ENVIRONMENT TRANS_USE_MPI=0 )

  ecbuild_add_test( TARGET ectrans_test_transi_lam_invtrans_adjoint
    SOURCES   transi/transi_test_lam_invtrans_adjoint.c
    LIBS      ectrans_test
    LINKER_LANGUAGE C
    CONDITION HAVE_ETRANS
    ENVIRONMENT TRANS_USE_MPI=0 )
endif()