-
Notifications
You must be signed in to change notification settings - Fork 572
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Combine array and mask approaches in one solution_2
- Loading branch information
Showing
11 changed files
with
67 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
.vscore/** | ||
.vscore/** | ||
*.exe |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,19 @@ | ||
FROM ubuntu:22.04 AS build | ||
|
||
RUN apt-get update -qq \ | ||
&& apt-get install -y clang | ||
&& apt-get install -y bash clang | ||
|
||
WORKDIR /opt/app | ||
COPY *.cpp . | ||
RUN clang++ -march=native -mtune=native -pthread -Ofast -std=c++17 PrimeCPP_PAR.cpp -oprimes_par | ||
RUN clang++ -march=native -mtune=native -pthread -Ofast -std=c++17 PrimeCPP_array.cpp -oprimes_array | ||
RUN clang++ -march=native -mtune=native -pthread -Ofast -std=c++17 PrimeCPP_mask.cpp -oprimes_mask | ||
Check notice on line 9 in PrimeCPP/solution_2/Dockerfile GitHub Actions / build (PrimeCPP/solution_2)
|
||
|
||
FROM ubuntu:22.04 | ||
COPY --from=build /opt/app/primes_par /usr/local/bin | ||
|
||
ENTRYPOINT [ "primes_par", "-l", "1000000" ] | ||
COPY --from=build /opt/app/primes_array /opt/app/primes_mask /opt/app/ | ||
|
||
WORKDIR /opt/app | ||
COPY benchmark.sh . | ||
|
||
ENTRYPOINT [ "./benchmark.sh"] | ||
CMD ["both", "-l", "1000000" ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#!/bin/bash | ||
|
||
if [[ $1 == both || $1 == 1 || $1 == array ]]; then | ||
./primes_array ${@:2} | ||
fi | ||
|
||
if [[ $1 == both || $1 == 2 || $1 == mask ]]; then | ||
./primes_mask ${@:2} | ||
fi |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,9 @@ | ||
g++ -Ofast PrimeCPP_PAR.cpp -std=c++17 -lstdc++ -oPrimes_par_gcc.exe | ||
.\Primes_par_gcc.exe | ||
IF "%1" == "" || "%1" == "1" || "%1" == "array" ( | ||
g++ -Ofast PrimeCPP_array.cpp -std=c++17 -lstdc++ -oPrimes_array.exe | ||
.\Primes_array.exe | ||
) | ||
|
||
IF "%1" == "" || "%1" == "2" || "%1" == "mask" ( | ||
g++ -Ofast PrimeCPP_mask.cpp -std=c++17 -lstdc++ -oPrimes_mask.exe | ||
.\Primes_mask.exe | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,17 @@ | ||
#!/bin/bash | ||
|
||
# g++ -Ofast -std=c++17 -lc++ PrimeCPP.cpp -oPrimes.exe | ||
# gcc -Ofast -std=c++17 PrimeCPP.cpp -lc++ -oPrimes_gcc.exe | ||
# clang -Ofast -std=c++17 -lc++ PrimeCPP.cpp -oPrimes_clang.exe | ||
|
||
clang++ -march=native -mtune=native -pthread -Ofast -std=c++17 PrimeCPP_PAR.cpp -oprimes_par.exe | ||
./primes_par.exe | ||
if [[ "$#" -eq "0" -o "$1" -eq "1" -o "$1" -eq "array" ]]; then | ||
echo "Building and running the array approach" | ||
clang++ -march=native -mtune=native -pthread -Ofast -std=c++17 PrimeCPP_array.cpp -oprimes_array.exe | ||
./primes_array.exe | ||
fi | ||
|
||
if [[ "$#" -eq "0" -o "$1" -eq "2" -o "$1" -eq "mask" ]]; then | ||
echo "Building and running the mask approach" | ||
clang++ -march=native -mtune=native -pthread -Ofast -std=c++17 PrimeCPP_mask.cpp -oprimes_mask.exe | ||
./primes_mask.exe | ||
fi |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.