uncommented fortran

This commit is contained in:
Ziad Arafat committed 2023-03-06 00:50:53 -07:00
1 parent 4d9f1e5200
commit 092b901c54
1 file changed
+20 -72
+20 -72
View File
@@ -20,38 +20,18 @@
},
{
"cell_type": "code",
"execution_count": 1,
"execution_count": null,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Requirement already satisfied: pip in /home/ziad/angelsshit/lib/python3.8/site-packages (23.0.1)\n"
]
}
],
"outputs": [],
"source": [
"!pip install -U pip"
]
},
{
"cell_type": "code",
"execution_count": 2,
"execution_count": null,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"rm -f *.o *.mod\n",
"gfortran -std=gnu -c mymodule.f90\n",
"gfortran -std=gnu -c gaussian_elimination.f90\n",
"gfortran mymodule.o gaussian_elimination.o -o gaussian_elimination\n",
"# gfortran -std=gnu -o gaussian_elimination gaussian_elimination.f90\n"
]
}
],
"outputs": [],
"source": [
"!make clean\n",
"!make"
@@ -66,7 +46,7 @@
},
{
"cell_type": "code",
"execution_count": 3,
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
@@ -107,7 +87,7 @@
},
{
"cell_type": "code",
"execution_count": 4,
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
@@ -142,7 +122,7 @@
},
{
"cell_type": "code",
"execution_count": 5,
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
@@ -193,7 +173,7 @@
},
{
"cell_type": "code",
"execution_count": 6,
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
@@ -242,7 +222,7 @@
},
{
"cell_type": "code",
"execution_count": 7,
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
@@ -281,7 +261,7 @@
},
{
"cell_type": "code",
"execution_count": 8,
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
@@ -315,33 +295,9 @@
},
{
"cell_type": "code",
"execution_count": 13,
"execution_count": null,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"[[-666.640368959479, 1329.4297491024777, -1167.557527078372, 1848.77714139224, 426.966687161967], [-942.9840728205336, -288.61828996119107, 1087.8339360817063, -1060.1480201222832, 462.8006923632993], [1103.733385004628, -597.3675732772756, -606.8842071110296, -1282.4711996807214, 1965.2159336968748], [500.3914284282855, 1597.7104977566382, 992.166922262034, -1071.7280978538633, 1565.5405624473738], [-1325.6784598789882, -378.15040633898434, 1679.8796134800264, -1466.4878342626143, 1141.5293948137219]]\n",
"(5, 5)\n",
"Executing python with 250 number 1\n",
"Executing numpy with 250 number 1\n",
"(250, 250) (250,)\n",
"Executing python with 250 number 2\n",
"Executing numpy with 250 number 2\n",
"(250, 250) (250,)\n",
"Executing python with 250 number 3\n",
"Executing numpy with 250 number 3\n",
"(250, 250) (250,)\n",
"Executing python with 250 number 4\n",
"Executing numpy with 250 number 4\n",
"(250, 250) (250,)\n",
"Executing python with 250 number 5\n",
"Executing numpy with 250 number 5\n",
"(250, 250) (250,)\n"
]
}
],
"outputs": [],
"source": [
"def run_and_measure_fortran():\n",
" args = generate_fortran_args(10,\n",
@@ -367,12 +323,12 @@
" for sample in range(sample_size):\n",
" matrix, vector = generate_matrix_and_vector(n_size)\n",
" fortran_args = generate_fortran_args(matrix, vector)\n",
" # print(\"There are\",len(fortran_args), \"ARGS\")\n",
" print(\"There are\",len(fortran_args), \"ARGS\")\n",
" \n",
" # print(\"Executing Fortran with\", n_size, \"number\", sample+1)\n",
" # result_fortran = measure_time(execute_fortran_program,\n",
" # fortran_args)\n",
" # results[\"fortran\"][n_size].append(result_fortran)\n",
" print(\"Executing Fortran with\", n_size, \"number\", sample+1)\n",
" result_fortran = measure_time(execute_fortran_program,\n",
" fortran_args)\n",
" results[\"fortran\"][n_size].append(result_fortran)\n",
" # execute_fortran_program(fortran_args)\n",
" \n",
" print(\"Executing python with\", n_size, \"number\", sample+1)\n",
@@ -391,17 +347,9 @@
},
{
"cell_type": "code",
"execution_count": 10,
"execution_count": null,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"{'fortran': {250: [], 200: []}, 'python no numpy': {250: [0.3963027000427246, 0.4253401756286621, 0.42356324195861816, 0.4331390857696533, 0.42368364334106445], 200: [0.23825478553771973, 0.2487194538116455, 0.23499631881713867, 0.24068498611450195, 0.23737192153930664]}, 'python with numpy': {250: [1.0382163524627686, 0.39327239990234375, 1.24161958694458, 0.48956751823425293, 0.32180094718933105], 200: [0.3028287887573242, 0.18131327629089355, 0.5121557712554932, 1.0093038082122803, 0.3794260025024414]}}\n"
]
}
],
"outputs": [],
"source": [
"print(results)"
]
@@ -423,7 +371,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.10"
"version": "3.10.9"
},
"vscode": {
"interpreter": {