Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
MPIfR-BDG
psrdada_cpp
Commits
be610572
Commit
be610572
authored
Nov 17, 2020
by
Tobias Winchen
Browse files
Merge branch 'ci' into 'devel'
Basic CI/CD setup See merge request
!1
parents
94761ee4
42b8b9d7
Pipeline
#86824
passed with stages
in 5 minutes and 50 seconds
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
.gitlab-ci.yml
0 → 100644
View file @
be610572
stages
:
-
build
-
test
-
deploy
image
:
edd01:5000/eddbase
before_script
:
-
git submodule init
-
git submodule update
build_cuda
:
stage
:
build
script
:
-
mkdir build
-
cd build
-
cmake .. -DPSRDADA_INCLUDE_DIR=/usr/local/include/psrdada -DENABLE_CUDA=True
-
make -j8
artifacts
:
paths
:
-
build
run_tests
:
stage
:
test
script
:
-
cd build
-
make CTEST_OUTPUT_ON_FAILURE=1 test
psrdada_cpp/effelsberg/edd/test/src/SpectralKurtosisTester.cpp
View file @
be610572
...
...
@@ -22,7 +22,7 @@ void SpectralKurtosisTester::TearDown()
{
}
void
SpectralKurtosisTester
::
test_vector_generation
(
std
::
size_t
sample_size
,
std
::
size_t
window_size
,
void
SpectralKurtosisTester
::
test_vector_generation
(
std
::
size_t
sample_size
,
std
::
size_t
window_size
,
bool
with_rfi
,
float
rfi_freq
,
float
rfi_amp
,
const
std
::
vector
<
int
>
&
rfi_window_indices
,
std
::
vector
<
std
::
complex
<
float
>>
&
samples
)
...
...
@@ -33,12 +33,12 @@ void SpectralKurtosisTester::test_vector_generation(std::size_t sample_size, std
tv
.
generate_test_vector
(
rfi_window_indices
,
samples
);
}
void
SpectralKurtosisTester
::
sk_computation
(
std
::
size_t
nch
,
std
::
size_t
window_size
,
void
SpectralKurtosisTester
::
sk_computation
(
std
::
size_t
nch
,
std
::
size_t
window_size
,
const
std
::
vector
<
std
::
complex
<
float
>>
&
samples
,
RFIStatistics
&
stat
)
{
float
sk_min
=
0.8
;
float
sk_max
=
1.2
;
float
sk_max
=
1.2
;
SpectralKurtosis
sk
(
nch
,
window_size
,
sk_min
,
sk_max
);
sk
.
compute_sk
(
samples
,
stat
);
}
...
...
@@ -68,7 +68,7 @@ TEST_F(SpectralKurtosisTester, sk_withoutRFI)
std
::
size_t
nch
=
1
;
sk_computation
(
nch
,
window_size
,
samples
,
stat
);
float
expected_rfi_fraction
=
0
;
EXPECT_EQ
(
expected_rfi_fraction
,
stat
.
rfi_fraction
);
EXPECT_
FLOAT_
EQ
(
expected_rfi_fraction
,
stat
.
rfi_fraction
);
}
TEST_F
(
SpectralKurtosisTester
,
sk_withRFI
)
...
...
@@ -83,7 +83,7 @@ TEST_F(SpectralKurtosisTester, sk_withRFI)
std
::
size_t
nch
=
1
;
sk_computation
(
nch
,
window_size
,
samples
,
stat
);
float
expected_rfi_fraction
=
(
rfi_window_indices
.
size
()
/
float
(
sample_size
/
window_size
))
+
0.01
;
EXPECT_EQ
(
expected_rfi_fraction
,
stat
.
rfi_fraction
);
//To check: fails inspite of actual and expected values being same.
EXPECT_
FLOAT_
EQ
(
expected_rfi_fraction
,
stat
.
rfi_fraction
);
//To check: fails inspite of actual and expected values being same.
}
TEST_F
(
SpectralKurtosisTester
,
sk_replacement
)
...
...
@@ -100,7 +100,7 @@ TEST_F(SpectralKurtosisTester, sk_replacement)
std
::
vector
<
int
>
rfi_window_indices
{
1
,
2
,
3
,
4
,
6
,
7
,
8
,
9
,
20
,
30
,
40
};
std
::
vector
<
std
::
complex
<
float
>>
samples
;
tv
.
generate_test_vector
(
rfi_window_indices
,
samples
);
//generating test vector
//SK
std
::
size_t
nch
=
1
;
float
sk_min
=
0.8
;
...
...
psrdada_cpp/effelsberg/paf/test/src/UnpackerTester.cu
View file @
be610572
#include
"psrdada_cpp/effelsberg/paf/test/UnpackerTester.cuh"
#include
"psrdada_cpp/cli_utils.hpp"
#include
"psrdada_cpp/cuda_utils.hpp"
#include
<random>
...
...
@@ -59,27 +60,40 @@ void UnpackerTester::compare_against_host(
}
}
TEST_F
(
UnpackerTester
,
paf_unpack_test
)
{
std
::
size_t
n
=
1024
*
3
;
std
::
default_random_engine
generator
;
std
::
uniform_int_distribution
<
int
>
distribution
(
1
,
1
<<
31
);
InputType
host_input
(
n
);
for
(
size_t
ii
=
0
;
ii
<
n
;
++
ii
)
{
host_input
[
ii
]
=
distribution
(
generator
);
}
Unpacker
::
InputType
gpu_input
=
host_input
;
Unpacker
::
OutputType
gpu_output
;
OutputType
host_output
;
Unpacker
unpacker
(
_stream
);
unpacker
.
unpack
(
gpu_input
,
gpu_output
);
unpacker_c_reference
(
host_input
,
host_output
);
compare_against_host
(
gpu_output
,
host_output
);
}
//
TEST_F(UnpackerTester, paf_unpack_test)
//
{
//
std::size_t n = 1024 * 3;
//
std::default_random_engine generator;
//
std::uniform_int_distribution<int> distribution(1,1<<31);
//
InputType host_input(n);
//
for (size_t ii = 0; ii < n; ++ii)
//
{
//
host_input[ii] = distribution(generator);
//
}
//
Unpacker::InputType gpu_input = host_input;
//
Unpacker::OutputType gpu_output;
//
OutputType host_output
.resize(n)
;
//
Unpacker unpacker(_stream);
//
unpacker.unpack(gpu_input, gpu_output);
//
unpacker_c_reference(host_input, host_output);
//
compare_against_host(gpu_output, host_output);
//
}
}
//namespace test
}
//namespace paf
}
//namespace meerkat
}
//namespace psrdada_cpp
int
main
(
int
argc
,
char
**
argv
)
{
char
*
val
=
getenv
(
"LOG_LEVEL"
);
if
(
val
)
{
psrdada_cpp
::
set_log_level
(
val
);
}
::
testing
::
InitGoogleTest
(
&
argc
,
argv
);
return
RUN_ALL_TESTS
();
}
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment