Skip to content

Commit

Permalink
Added tests for gcd_ and lcm_ to improve code coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
LScheib committed Dec 6, 2023
1 parent 0b9c622 commit 98d15f6
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions heat/core/tests/test_arithmetics.py
Original file line number Diff line number Diff line change
Expand Up @@ -2382,6 +2382,9 @@ def test_gcd_(self):
with self.assertRaises(TypeError):
a_tensor.gcd_(an_int_tensor)
a_tensor = self.a_tensor.copy() # reset
with self.assertRaises(TypeError):
a_tensor.gcd_(a_tensor)
a_tensor = self.a_tensor.copy() # reset
with self.assertRaises(ValueError):
an_int_tensor.gcd_(another_int_vector)
an_int_tensor = self.an_int_tensor.copy() # reset
Expand Down Expand Up @@ -2806,6 +2809,9 @@ def test_lcm_(self):
with self.assertRaises(TypeError):
a_tensor.lcm_(an_int_tensor)
a_tensor = self.a_tensor.copy() # reset
with self.assertRaises(TypeError):
a_tensor.lcm_(a_tensor)
a_tensor = self.a_tensor.copy() # reset
with self.assertRaises(ValueError):
an_int_tensor.lcm_(another_int_vector)
an_int_tensor = self.an_int_tensor.copy() # reset
Expand Down

2 comments on commit 98d15f6

@github-actions
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Performance Alert ⚠️

Possible performance regression was detected for benchmark.
Benchmark result of this commit is worse than the previous benchmark result exceeding threshold 2.

Benchmark suite Current: 98d15f6 Previous: aa24cc6 Ratio
matmul_split_0_N1_GPU - GPU_UTIL 16.677302622795104 % (19.44264375257178) 7.494762682914734 % (1.9601779739485736) 2.23
matmul_split_1_N1_GPU - GPU_UTIL 16.686889743804933 % (19.436272834424106) 7.5093554019927975 % (1.9183619789957178) 2.22
qr_split_0_N1_GPU - GPU_UTIL 16.74921612739563 % (19.395844045432177) 7.587315940856934 % (1.6995979481097674) 2.21
qr_split_1_N1_GPU - GPU_UTIL 16.804400730133057 % (19.361484649419765) 7.685315656661987 % (1.4326919432122232) 2.19
lanczos_N1_GPU - GPU_UTIL 16.80450439453125 % (19.36142137994303) 7.702353072166443 % (1.3994277634000958) 2.18
hierachical_svd_rank_N1_GPU - GPU_UTIL 16.804685592651367 % (19.361310800821617) 7.7034773349761965 % (1.3984162736066) 2.18
hierachical_svd_tol_N1_GPU - GPU_UTIL 16.80485987663269 % (19.361204454970572) 7.703679203987122 % (1.3978171356685885) 2.18
kmeans_N1_GPU - GPU_UTIL 16.80696530342102 % (19.36069036919432) 7.704399585723877 % (1.3934015061691742) 2.18
kmedians_N1_GPU - GPU_UTIL 17.84469051361084 % (19.553840953887875) 7.648647117614746 % (1.3592966649222809) 2.33
kmedoids_N1_GPU - GPU_UTIL 19.86178321838379 % (20.59182573433434) 7.641252756118774 % (1.3422939777374268) 2.60
reshape_N1_GPU - GPU_UTIL 20.079497480392455 % (20.48177301194727) 7.724739503860474 % (1.091833734512329) 2.60
concatenate_N1_GPU - GPU_UTIL 20.081333303451537 % (20.480487644315055) 7.725827312469482 % (1.0885703086853027) 2.60
apply_inplace_standard_scaler_and_inverse_N1_GPU - GPU_UTIL 20.093851184844972 % (20.47176048439623) 7.733374404907226 % (1.0659290313720704) 2.60
apply_inplace_min_max_scaler_and_inverse_N1_GPU - GPU_UTIL 20.10331106185913 % (20.465208536946633) 7.738512420654297 % (1.0505149841308594) 2.60
apply_inplace_max_abs_scaler_and_inverse_N1_GPU - GPU_UTIL 20.104637956619264 % (20.464292504085446) 7.739448404312133 % (1.0477070331573486) 2.60
apply_inplace_robust_scaler_and_inverse_N1_GPU - GPU_UTIL 17.523745441436766 % (16.48176850157363) 8.092453861236573 % (0.03430347227936351) 2.17
apply_inplace_normalizer_N1_GPU - GPU_UTIL 17.11456298828125 % (19.19380911194106) 8.15460205078125 % (0.19775390625) 2.10
heat_benchmarks_N4_CPU - ENERGY 0.9580445343017578 kJ (0.7308712536478827) 0.26456218872070314 kJ (0.24111720353696403) 3.62
matmul_split_0_N4_CPU - POWER 28.294230808425027 W (19.467854300064996) 7.39884296777836 W (0.7318433929063448) 3.82
matmul_split_0_N4_CPU - GPU_UTIL 21.014373955130576 % (29.97671341061106) 0.70343017578125 % 29.87
matmul_split_1_N4_CPU - POWER 29.93122745180549 W (19.971343144254547) 8.056973760569637 W (2.181284755900576) 3.71
matmul_split_1_N4_CPU - GPU_UTIL 21.077794587612154 % (29.935524512085824) 0.7178921863436699 % (0.04338603168725967) 29.36
qr_split_0_N4_CPU - POWER 30.80266063619826 W (20.880847196721984) 10.397967703519555 W (9.703161476035854) 2.96
qr_split_0_N4_CPU - GPU_UTIL 21.08941650390625 % (29.92799283922866) 0.7700019687414169 % (0.19971537888050078) 27.39
qr_split_1_N4_CPU - POWER 31.676569888903465 W (21.922743351418237) 10.644564371201898 W (10.622890888229445) 2.98
qr_split_1_N4_CPU - GPU_UTIL 21.09283447265625 % (29.925744650593934) 0.7688272148370743 % (0.19619111716747284) 27.44
lanczos_N4_CPU - POWER 31.431129170780366 W (21.730591099940902) 10.82063966456283 W (10.640864706547195) 2.90
lanczos_N4_CPU - GPU_UTIL 21.093570998311044 % (29.925274154479368) 0.76812744140625 % (0.194091796875) 27.46
hierachical_svd_rank_N4_CPU - POWER 31.265261205347382 W (21.55927603690621) 10.86356169484807 W (10.632276169940004) 2.88
hierachical_svd_rank_N4_CPU - GPU_UTIL 21.100040018558502 % (29.92114840586517) 0.76812744140625 % (0.194091796875) 27.47
hierachical_svd_tol_N4_CPU - POWER 31.214774403715932 W (21.493423423562216) 10.829572575234435 W (10.644400945825511) 2.88
hierachical_svd_tol_N4_CPU - GPU_UTIL 21.104612511396407 % (29.918239456582576) 0.76812744140625 % (0.194091796875) 27.48
kmeans_N4_CPU - POWER 31.07339308131647 W (21.36874987323684) 10.724486895713834 W (10.690487183908246) 2.90
kmeans_N4_CPU - GPU_UTIL 21.109398531913758 % (29.915201098852645) 0.768135130405426 % (0.19411486387252808) 27.48
kmedians_N4_CPU - POWER 31.13630971973641 W (21.31148763065584) 10.675695306180566 W (10.693639652404771) 2.92
kmedians_N4_CPU - GPU_UTIL 21.10992431640625 % (29.914867711083133) 0.7714668035507202 % (0.20410988330841065) 27.36
kmedoids_N4_CPU - POWER 33.65380735992689 W (20.09837430453623) 10.675313885648022 W (10.72320122206125) 3.15
kmedoids_N4_CPU - GPU_UTIL 21.09561981856823 % (29.924310458535402) 0.7716054230928421 % (0.20452574193477632) 27.34
reshape_N4_CPU - POWER 34.98558409634059 W (20.674280055922882) 10.69846746021771 W (10.68668083767328) 3.27
reshape_N4_CPU - GPU_UTIL 21.046218161284923 % (29.95737155967966) 0.7683437556028366 % (0.1947407394647598) 27.39
concatenate_N4_CPU - POWER 34.196481075276374 W (20.095453336524763) 10.698451090155274 W (10.736623127364687) 3.20
concatenate_N4_CPU - GPU_UTIL 21.03790283203125 % (29.96300492495824) 0.76812744140625 % (0.194091796875) 27.39
apply_inplace_standard_scaler_and_inverse_N4_CPU - POWER 33.57437927334648 W (19.671931831572174) 10.700571600317536 W (10.748565555173947) 3.14
apply_inplace_standard_scaler_and_inverse_N4_CPU - GPU_UTIL 21.03790283203125 % (29.96300492495824) 0.76812744140625 % (0.194091796875) 27.39
apply_inplace_min_max_scaler_and_inverse_N4_CPU - POWER 33.53892001409871 W (19.65248113734699) 10.700892481733423 W (10.748451945629833) 3.13
apply_inplace_min_max_scaler_and_inverse_N4_CPU - GPU_UTIL 21.03790283203125 % (29.96300492495824) 0.76812744140625 % (0.194091796875) 27.39
apply_inplace_max_abs_scaler_and_inverse_N4_CPU - POWER 33.53278885678261 W (19.648846487665413) 10.700934042776371 W (10.748437418475802) 3.13
apply_inplace_max_abs_scaler_and_inverse_N4_CPU - GPU_UTIL 21.03790283203125 % (29.96300492495824) 0.76812744140625 % (0.194091796875) 27.39
apply_inplace_robust_scaler_and_inverse_N4_CPU - POWER 28.704394785828356 W (18.94243970266043) 10.208122554398265 W (9.250296306042191) 2.81
apply_inplace_robust_scaler_and_inverse_N4_CPU - GPU_UTIL 16.423441576957703 % (25.82691335531504) 0.72930908203125 % (0.07763671875) 22.52
apply_inplace_normalizer_N4_CPU - POWER 25.870531023710377 W (19.674870395274112) 7.375957863049949 W (0.6583648972510667) 3.51
apply_inplace_normalizer_N4_CPU - GPU_UTIL 14.49127197265625 % (26.15861143825865) 0.70343017578125 % 20.60

This comment was automatically generated by workflow using github-action-benchmark.

CC: @LScheib

@github-actions
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Performance Alert ⚠️

Possible performance regression was detected for benchmark.
Benchmark result of this commit is worse than the previous benchmark result exceeding threshold 2.

Benchmark suite Current: 98d15f6 Previous: aa24cc6 Ratio
matmul_split_0_N1_GPU - GPU_UTIL 16.677302622795104 % (19.44264375257178) 7.494762682914734 % (1.9601779739485736) 2.23
matmul_split_1_N1_GPU - GPU_UTIL 16.686889743804933 % (19.436272834424106) 7.5093554019927975 % (1.9183619789957178) 2.22
qr_split_0_N1_GPU - GPU_UTIL 16.74921612739563 % (19.395844045432177) 7.587315940856934 % (1.6995979481097674) 2.21
qr_split_1_N1_GPU - GPU_UTIL 16.804400730133057 % (19.361484649419765) 7.685315656661987 % (1.4326919432122232) 2.19
lanczos_N1_GPU - GPU_UTIL 16.80450439453125 % (19.36142137994303) 7.702353072166443 % (1.3994277634000958) 2.18
hierachical_svd_rank_N1_GPU - GPU_UTIL 16.804685592651367 % (19.361310800821617) 7.7034773349761965 % (1.3984162736066) 2.18
hierachical_svd_tol_N1_GPU - GPU_UTIL 16.80485987663269 % (19.361204454970572) 7.703679203987122 % (1.3978171356685885) 2.18
kmeans_N1_GPU - GPU_UTIL 16.80696530342102 % (19.36069036919432) 7.704399585723877 % (1.3934015061691742) 2.18
kmedians_N1_GPU - GPU_UTIL 17.84469051361084 % (19.553840953887875) 7.648647117614746 % (1.3592966649222809) 2.33
kmedoids_N1_GPU - GPU_UTIL 19.86178321838379 % (20.59182573433434) 7.641252756118774 % (1.3422939777374268) 2.60
reshape_N1_GPU - GPU_UTIL 20.079497480392455 % (20.48177301194727) 7.724739503860474 % (1.091833734512329) 2.60
concatenate_N1_GPU - GPU_UTIL 20.081333303451537 % (20.480487644315055) 7.725827312469482 % (1.0885703086853027) 2.60
apply_inplace_standard_scaler_and_inverse_N1_GPU - GPU_UTIL 20.093851184844972 % (20.47176048439623) 7.733374404907226 % (1.0659290313720704) 2.60
apply_inplace_min_max_scaler_and_inverse_N1_GPU - GPU_UTIL 20.10331106185913 % (20.465208536946633) 7.738512420654297 % (1.0505149841308594) 2.60
apply_inplace_max_abs_scaler_and_inverse_N1_GPU - GPU_UTIL 20.104637956619264 % (20.464292504085446) 7.739448404312133 % (1.0477070331573486) 2.60
apply_inplace_robust_scaler_and_inverse_N1_GPU - GPU_UTIL 17.523745441436766 % (16.48176850157363) 8.092453861236573 % (0.03430347227936351) 2.17
apply_inplace_normalizer_N1_GPU - GPU_UTIL 17.11456298828125 % (19.19380911194106) 8.15460205078125 % (0.19775390625) 2.10
heat_benchmarks_N4_CPU - ENERGY 0.9580445343017578 kJ (0.7308712536478827) 0.26456218872070314 kJ (0.24111720353696403) 3.62
matmul_split_0_N4_CPU - POWER 28.294230808425027 W (19.467854300064996) 7.39884296777836 W (0.7318433929063448) 3.82
matmul_split_0_N4_CPU - GPU_UTIL 21.014373955130576 % (29.97671341061106) 0.70343017578125 % 29.87
matmul_split_1_N4_CPU - POWER 29.93122745180549 W (19.971343144254547) 8.056973760569637 W (2.181284755900576) 3.71
matmul_split_1_N4_CPU - GPU_UTIL 21.077794587612154 % (29.935524512085824) 0.7178921863436699 % (0.04338603168725967) 29.36
qr_split_0_N4_CPU - POWER 30.80266063619826 W (20.880847196721984) 10.397967703519555 W (9.703161476035854) 2.96
qr_split_0_N4_CPU - GPU_UTIL 21.08941650390625 % (29.92799283922866) 0.7700019687414169 % (0.19971537888050078) 27.39
qr_split_1_N4_CPU - POWER 31.676569888903465 W (21.922743351418237) 10.644564371201898 W (10.622890888229445) 2.98
qr_split_1_N4_CPU - GPU_UTIL 21.09283447265625 % (29.925744650593934) 0.7688272148370743 % (0.19619111716747284) 27.44
lanczos_N4_CPU - POWER 31.431129170780366 W (21.730591099940902) 10.82063966456283 W (10.640864706547195) 2.90
lanczos_N4_CPU - GPU_UTIL 21.093570998311044 % (29.925274154479368) 0.76812744140625 % (0.194091796875) 27.46
hierachical_svd_rank_N4_CPU - POWER 31.265261205347382 W (21.55927603690621) 10.86356169484807 W (10.632276169940004) 2.88
hierachical_svd_rank_N4_CPU - GPU_UTIL 21.100040018558502 % (29.92114840586517) 0.76812744140625 % (0.194091796875) 27.47
hierachical_svd_tol_N4_CPU - POWER 31.214774403715932 W (21.493423423562216) 10.829572575234435 W (10.644400945825511) 2.88
hierachical_svd_tol_N4_CPU - GPU_UTIL 21.104612511396407 % (29.918239456582576) 0.76812744140625 % (0.194091796875) 27.48
kmeans_N4_CPU - POWER 31.07339308131647 W (21.36874987323684) 10.724486895713834 W (10.690487183908246) 2.90
kmeans_N4_CPU - GPU_UTIL 21.109398531913758 % (29.915201098852645) 0.768135130405426 % (0.19411486387252808) 27.48
kmedians_N4_CPU - POWER 31.13630971973641 W (21.31148763065584) 10.675695306180566 W (10.693639652404771) 2.92
kmedians_N4_CPU - GPU_UTIL 21.10992431640625 % (29.914867711083133) 0.7714668035507202 % (0.20410988330841065) 27.36
kmedoids_N4_CPU - POWER 33.65380735992689 W (20.09837430453623) 10.675313885648022 W (10.72320122206125) 3.15
kmedoids_N4_CPU - GPU_UTIL 21.09561981856823 % (29.924310458535402) 0.7716054230928421 % (0.20452574193477632) 27.34
reshape_N4_CPU - POWER 34.98558409634059 W (20.674280055922882) 10.69846746021771 W (10.68668083767328) 3.27
reshape_N4_CPU - GPU_UTIL 21.046218161284923 % (29.95737155967966) 0.7683437556028366 % (0.1947407394647598) 27.39
concatenate_N4_CPU - POWER 34.196481075276374 W (20.095453336524763) 10.698451090155274 W (10.736623127364687) 3.20
concatenate_N4_CPU - GPU_UTIL 21.03790283203125 % (29.96300492495824) 0.76812744140625 % (0.194091796875) 27.39
apply_inplace_standard_scaler_and_inverse_N4_CPU - POWER 33.57437927334648 W (19.671931831572174) 10.700571600317536 W (10.748565555173947) 3.14
apply_inplace_standard_scaler_and_inverse_N4_CPU - GPU_UTIL 21.03790283203125 % (29.96300492495824) 0.76812744140625 % (0.194091796875) 27.39
apply_inplace_min_max_scaler_and_inverse_N4_CPU - POWER 33.53892001409871 W (19.65248113734699) 10.700892481733423 W (10.748451945629833) 3.13
apply_inplace_min_max_scaler_and_inverse_N4_CPU - GPU_UTIL 21.03790283203125 % (29.96300492495824) 0.76812744140625 % (0.194091796875) 27.39
apply_inplace_max_abs_scaler_and_inverse_N4_CPU - POWER 33.53278885678261 W (19.648846487665413) 10.700934042776371 W (10.748437418475802) 3.13
apply_inplace_max_abs_scaler_and_inverse_N4_CPU - GPU_UTIL 21.03790283203125 % (29.96300492495824) 0.76812744140625 % (0.194091796875) 27.39
apply_inplace_robust_scaler_and_inverse_N4_CPU - POWER 28.704394785828356 W (18.94243970266043) 10.208122554398265 W (9.250296306042191) 2.81
apply_inplace_robust_scaler_and_inverse_N4_CPU - GPU_UTIL 16.423441576957703 % (25.82691335531504) 0.72930908203125 % (0.07763671875) 22.52
apply_inplace_normalizer_N4_CPU - POWER 25.870531023710377 W (19.674870395274112) 7.375957863049949 W (0.6583648972510667) 3.51
apply_inplace_normalizer_N4_CPU - GPU_UTIL 14.49127197265625 % (26.15861143825865) 0.70343017578125 % 20.60

This comment was automatically generated by workflow using github-action-benchmark.

CC: @LScheib

Please sign in to comment.