<?xml version="1.0" encoding="UTF-8"?>

<!--XBRL Document Created with the Workiva Platform-->
<!--Copyright 2024 Workiva-->
<!--r:16b3d747-c650-4bc0-b119-9a0880ae19bc,g:c48ef896-bbe8-4c05-8c97-3d946f48cd13-->
<link:linkbase xmlns:link="http://www.xbrl.org/2003/linkbase" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.xbrl.org/2003/linkbase http://www.xbrl.org/2003/xbrl-linkbase-2003-12-31.xsd">
  <link:roleRef roleURI="http://www.sanmina.com/role/CondensedConsolidatedBalanceSheets" xlink:type="simple" xlink:href="sanm-20231230.xsd#CondensedConsolidatedBalanceSheets"/>
  <link:calculationLink xlink:role="http://www.sanmina.com/role/CondensedConsolidatedBalanceSheets" xlink:type="extended">
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_LiabilitiesNoncurrent_fbcc64cf-423b-437c-8d79-feab355b9a5d" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_LiabilitiesNoncurrent"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_LongTermDebtNoncurrent_a2ec74c1-3dda-47fe-bb52-704378eb9fb9" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_LongTermDebtNoncurrent"/>
    <link:calculationArc order="1" weight="1.0" xlink:arcrole="http://www.xbrl.org/2003/arcrole/summation-item" xlink:from="loc_us-gaap_LiabilitiesNoncurrent_fbcc64cf-423b-437c-8d79-feab355b9a5d" xlink:to="loc_us-gaap_LongTermDebtNoncurrent_a2ec74c1-3dda-47fe-bb52-704378eb9fb9" xlink:type="arc"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_OtherLiabilitiesNoncurrent_8e55e3ba-fd44-4656-acc8-1dd4a7196125" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_OtherLiabilitiesNoncurrent"/>
    <link:calculationArc order="2" weight="1.0" xlink:arcrole="http://www.xbrl.org/2003/arcrole/summation-item" xlink:from="loc_us-gaap_LiabilitiesNoncurrent_fbcc64cf-423b-437c-8d79-feab355b9a5d" xlink:to="loc_us-gaap_OtherLiabilitiesNoncurrent_8e55e3ba-fd44-4656-acc8-1dd4a7196125" xlink:type="arc"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_LiabilitiesCurrent_61ede51b-239c-4e3f-80f4-5525031de55d" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_LiabilitiesCurrent"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_AccountsPayableCurrent_6ca42ba5-9906-4131-913b-8100e3c69afc" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_AccountsPayableCurrent"/>
    <link:calculationArc order="1" weight="1.0" xlink:arcrole="http://www.xbrl.org/2003/arcrole/summation-item" xlink:from="loc_us-gaap_LiabilitiesCurrent_61ede51b-239c-4e3f-80f4-5525031de55d" xlink:to="loc_us-gaap_AccountsPayableCurrent_6ca42ba5-9906-4131-913b-8100e3c69afc" xlink:type="arc"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_OtherLiabilitiesCurrent_d5ba309e-92bf-40e6-a135-d25e3367a37f" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_OtherLiabilitiesCurrent"/>
    <link:calculationArc order="2" weight="1.0" xlink:arcrole="http://www.xbrl.org/2003/arcrole/summation-item" xlink:from="loc_us-gaap_LiabilitiesCurrent_61ede51b-239c-4e3f-80f4-5525031de55d" xlink:to="loc_us-gaap_OtherLiabilitiesCurrent_d5ba309e-92bf-40e6-a135-d25e3367a37f" xlink:type="arc"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_EmployeeRelatedLiabilitiesCurrent_71f12321-f175-424e-ba9e-97032d3081f8" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_EmployeeRelatedLiabilitiesCurrent"/>
    <link:calculationArc order="3" weight="1.0" xlink:arcrole="http://www.xbrl.org/2003/arcrole/summation-item" xlink:from="loc_us-gaap_LiabilitiesCurrent_61ede51b-239c-4e3f-80f4-5525031de55d" xlink:to="loc_us-gaap_EmployeeRelatedLiabilitiesCurrent_71f12321-f175-424e-ba9e-97032d3081f8" xlink:type="arc"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_DebtCurrent_edcbbbad-98f6-43fa-80e0-82229885c69b" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_DebtCurrent"/>
    <link:calculationArc order="4" weight="1.0" xlink:arcrole="http://www.xbrl.org/2003/arcrole/summation-item" xlink:from="loc_us-gaap_LiabilitiesCurrent_61ede51b-239c-4e3f-80f4-5525031de55d" xlink:to="loc_us-gaap_DebtCurrent_edcbbbad-98f6-43fa-80e0-82229885c69b" xlink:type="arc"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_Assets_17fdf6c0-e453-4b08-85dd-f631f1f47974" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_Assets"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_AssetsCurrent_37453f31-c83c-480b-b8d1-7bf5c85af9f8" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_AssetsCurrent"/>
    <link:calculationArc order="1" weight="1.0" xlink:arcrole="http://www.xbrl.org/2003/arcrole/summation-item" xlink:from="loc_us-gaap_Assets_17fdf6c0-e453-4b08-85dd-f631f1f47974" xlink:to="loc_us-gaap_AssetsCurrent_37453f31-c83c-480b-b8d1-7bf5c85af9f8" xlink:type="arc"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_PropertyPlantAndEquipmentNet_2217a5f3-7a67-46ce-9b4c-0bdcee522190" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_PropertyPlantAndEquipmentNet"/>
    <link:calculationArc order="2" weight="1.0" xlink:arcrole="http://www.xbrl.org/2003/arcrole/summation-item" xlink:from="loc_us-gaap_Assets_17fdf6c0-e453-4b08-85dd-f631f1f47974" xlink:to="loc_us-gaap_PropertyPlantAndEquipmentNet_2217a5f3-7a67-46ce-9b4c-0bdcee522190" xlink:type="arc"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_DeferredIncomeTaxAssetsNet_0cd0714f-0585-48dc-af61-ae620b22be92" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_DeferredIncomeTaxAssetsNet"/>
    <link:calculationArc order="3" weight="1.0" xlink:arcrole="http://www.xbrl.org/2003/arcrole/summation-item" xlink:from="loc_us-gaap_Assets_17fdf6c0-e453-4b08-85dd-f631f1f47974" xlink:to="loc_us-gaap_DeferredIncomeTaxAssetsNet_0cd0714f-0585-48dc-af61-ae620b22be92" xlink:type="arc"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_OtherAssetsNoncurrent_561b4b0e-a3b8-46ca-8d6b-d9e1771bed1c" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_OtherAssetsNoncurrent"/>
    <link:calculationArc order="4" weight="1.0" xlink:arcrole="http://www.xbrl.org/2003/arcrole/summation-item" xlink:from="loc_us-gaap_Assets_17fdf6c0-e453-4b08-85dd-f631f1f47974" xlink:to="loc_us-gaap_OtherAssetsNoncurrent_561b4b0e-a3b8-46ca-8d6b-d9e1771bed1c" xlink:type="arc"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_AssetsCurrent_09550d86-3fa5-47f3-bcdb-0d701e67f5a0" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_AssetsCurrent"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_CashAndCashEquivalentsAtCarryingValue_218a88c8-46c2-43b8-b8e6-c1938b3a88bf" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_CashAndCashEquivalentsAtCarryingValue"/>
    <link:calculationArc order="1" weight="1.0" xlink:arcrole="http://www.xbrl.org/2003/arcrole/summation-item" xlink:from="loc_us-gaap_AssetsCurrent_09550d86-3fa5-47f3-bcdb-0d701e67f5a0" xlink:to="loc_us-gaap_CashAndCashEquivalentsAtCarryingValue_218a88c8-46c2-43b8-b8e6-c1938b3a88bf" xlink:type="arc"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_AccountsAndOtherReceivablesNetCurrent_d9570015-8daa-425b-91c3-9941a4696a9a" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_AccountsAndOtherReceivablesNetCurrent"/>
    <link:calculationArc order="2" weight="1.0" xlink:arcrole="http://www.xbrl.org/2003/arcrole/summation-item" xlink:from="loc_us-gaap_AssetsCurrent_09550d86-3fa5-47f3-bcdb-0d701e67f5a0" xlink:to="loc_us-gaap_AccountsAndOtherReceivablesNetCurrent_d9570015-8daa-425b-91c3-9941a4696a9a" xlink:type="arc"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_ContractWithCustomerAssetNetCurrent_1b72c61b-cd48-4e1e-9c27-8fce2186f40b" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_ContractWithCustomerAssetNetCurrent"/>
    <link:calculationArc order="3" weight="1.0" xlink:arcrole="http://www.xbrl.org/2003/arcrole/summation-item" xlink:from="loc_us-gaap_AssetsCurrent_09550d86-3fa5-47f3-bcdb-0d701e67f5a0" xlink:to="loc_us-gaap_ContractWithCustomerAssetNetCurrent_1b72c61b-cd48-4e1e-9c27-8fce2186f40b" xlink:type="arc"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_InventoryNet_5a4e9bb5-c716-4521-b007-96d4ac434a19" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_InventoryNet"/>
    <link:calculationArc order="4" weight="1.0" xlink:arcrole="http://www.xbrl.org/2003/arcrole/summation-item" xlink:from="loc_us-gaap_AssetsCurrent_09550d86-3fa5-47f3-bcdb-0d701e67f5a0" xlink:to="loc_us-gaap_InventoryNet_5a4e9bb5-c716-4521-b007-96d4ac434a19" xlink:type="arc"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_PrepaidExpenseAndOtherAssetsCurrent_aa583796-d00d-4959-bff1-fa72b75bf95a" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_PrepaidExpenseAndOtherAssetsCurrent"/>
    <link:calculationArc order="5" weight="1.0" xlink:arcrole="http://www.xbrl.org/2003/arcrole/summation-item" xlink:from="loc_us-gaap_AssetsCurrent_09550d86-3fa5-47f3-bcdb-0d701e67f5a0" xlink:to="loc_us-gaap_PrepaidExpenseAndOtherAssetsCurrent_aa583796-d00d-4959-bff1-fa72b75bf95a" xlink:type="arc"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_LiabilitiesAndStockholdersEquity_f05365be-6e3c-41ad-a8b4-b2c7f3c56c9b" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_LiabilitiesAndStockholdersEquity"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_LiabilitiesNoncurrent_b77fcb17-7482-46ef-b99c-4a09298ee649" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_LiabilitiesNoncurrent"/>
    <link:calculationArc order="1" weight="1.0" xlink:arcrole="http://www.xbrl.org/2003/arcrole/summation-item" xlink:from="loc_us-gaap_LiabilitiesAndStockholdersEquity_f05365be-6e3c-41ad-a8b4-b2c7f3c56c9b" xlink:to="loc_us-gaap_LiabilitiesNoncurrent_b77fcb17-7482-46ef-b99c-4a09298ee649" xlink:type="arc"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_LiabilitiesCurrent_54600fb6-7747-4dc6-a7d5-d15810ecf5f6" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_LiabilitiesCurrent"/>
    <link:calculationArc order="2" weight="1.0" xlink:arcrole="http://www.xbrl.org/2003/arcrole/summation-item" xlink:from="loc_us-gaap_LiabilitiesAndStockholdersEquity_f05365be-6e3c-41ad-a8b4-b2c7f3c56c9b" xlink:to="loc_us-gaap_LiabilitiesCurrent_54600fb6-7747-4dc6-a7d5-d15810ecf5f6" xlink:type="arc"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_StockholdersEquityIncludingPortionAttributableToNoncontrollingInterest_a9bcfb53-91ee-4c83-811c-ec2b744c4aae" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_StockholdersEquityIncludingPortionAttributableToNoncontrollingInterest"/>
    <link:calculationArc order="3" weight="1.0" xlink:arcrole="http://www.xbrl.org/2003/arcrole/summation-item" xlink:from="loc_us-gaap_LiabilitiesAndStockholdersEquity_f05365be-6e3c-41ad-a8b4-b2c7f3c56c9b" xlink:to="loc_us-gaap_StockholdersEquityIncludingPortionAttributableToNoncontrollingInterest_a9bcfb53-91ee-4c83-811c-ec2b744c4aae" xlink:type="arc"/>
  </link:calculationLink>
  <link:roleRef roleURI="http://www.sanmina.com/role/CondensedConsolidatedStatementsofIncome" xlink:type="simple" xlink:href="sanm-20231230.xsd#CondensedConsolidatedStatementsofIncome"/>
  <link:calculationLink xlink:role="http://www.sanmina.com/role/CondensedConsolidatedStatementsofIncome" xlink:type="extended">
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_NetIncomeLoss_68704550-96b7-403c-a724-51e001ed3d1d" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_NetIncomeLoss"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_ProfitLoss_871bcc51-5ed8-4732-9e47-b19fba6b63e4" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_ProfitLoss"/>
    <link:calculationArc order="1" weight="1.0" xlink:arcrole="http://www.xbrl.org/2003/arcrole/summation-item" xlink:from="loc_us-gaap_NetIncomeLoss_68704550-96b7-403c-a724-51e001ed3d1d" xlink:to="loc_us-gaap_ProfitLoss_871bcc51-5ed8-4732-9e47-b19fba6b63e4" xlink:type="arc"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_NetIncomeLossAttributableToNoncontrollingInterest_2f10d12e-a3d0-4664-9bd0-00047f43a4c1" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_NetIncomeLossAttributableToNoncontrollingInterest"/>
    <link:calculationArc order="2" weight="-1.0" xlink:arcrole="http://www.xbrl.org/2003/arcrole/summation-item" xlink:from="loc_us-gaap_NetIncomeLoss_68704550-96b7-403c-a724-51e001ed3d1d" xlink:to="loc_us-gaap_NetIncomeLossAttributableToNoncontrollingInterest_2f10d12e-a3d0-4664-9bd0-00047f43a4c1" xlink:type="arc"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_IncomeLossFromContinuingOperationsBeforeIncomeTaxesExtraordinaryItemsNoncontrollingInterest_689041db-8562-47b6-9698-0ad429ce69b3" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_IncomeLossFromContinuingOperationsBeforeIncomeTaxesExtraordinaryItemsNoncontrollingInterest"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_NonoperatingIncomeExpense_04b0283c-19d3-4303-a7e6-8a5a6005a886" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_NonoperatingIncomeExpense"/>
    <link:calculationArc order="1" weight="1.0" xlink:arcrole="http://www.xbrl.org/2003/arcrole/summation-item" xlink:from="loc_us-gaap_IncomeLossFromContinuingOperationsBeforeIncomeTaxesExtraordinaryItemsNoncontrollingInterest_689041db-8562-47b6-9698-0ad429ce69b3" xlink:to="loc_us-gaap_NonoperatingIncomeExpense_04b0283c-19d3-4303-a7e6-8a5a6005a886" xlink:type="arc"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_OperatingIncomeLoss_5e655ddd-9aa7-4246-97ae-6a209d2aa4a5" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_OperatingIncomeLoss"/>
    <link:calculationArc order="2" weight="1.0" xlink:arcrole="http://www.xbrl.org/2003/arcrole/summation-item" xlink:from="loc_us-gaap_IncomeLossFromContinuingOperationsBeforeIncomeTaxesExtraordinaryItemsNoncontrollingInterest_689041db-8562-47b6-9698-0ad429ce69b3" xlink:to="loc_us-gaap_OperatingIncomeLoss_5e655ddd-9aa7-4246-97ae-6a209d2aa4a5" xlink:type="arc"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_NonoperatingIncomeExpense_8a790e5d-2235-4d93-9db3-e3cc5cda9c6d" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_NonoperatingIncomeExpense"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_InterestAndOtherIncome_4b1430d6-d87a-4de3-9db2-b56774d7dd14" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_InterestAndOtherIncome"/>
    <link:calculationArc order="1" weight="1.0" xlink:arcrole="http://www.xbrl.org/2003/arcrole/summation-item" xlink:from="loc_us-gaap_NonoperatingIncomeExpense_8a790e5d-2235-4d93-9db3-e3cc5cda9c6d" xlink:to="loc_us-gaap_InterestAndOtherIncome_4b1430d6-d87a-4de3-9db2-b56774d7dd14" xlink:type="arc"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_InterestExpense_223ebc64-2d2a-47f6-be25-f94af0088cd9" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_InterestExpense"/>
    <link:calculationArc order="2" weight="-1.0" xlink:arcrole="http://www.xbrl.org/2003/arcrole/summation-item" xlink:from="loc_us-gaap_NonoperatingIncomeExpense_8a790e5d-2235-4d93-9db3-e3cc5cda9c6d" xlink:to="loc_us-gaap_InterestExpense_223ebc64-2d2a-47f6-be25-f94af0088cd9" xlink:type="arc"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_OtherNonoperatingIncomeExpense_9e5613d5-c83c-4c9d-8842-144873e369fd" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_OtherNonoperatingIncomeExpense"/>
    <link:calculationArc order="3" weight="1.0" xlink:arcrole="http://www.xbrl.org/2003/arcrole/summation-item" xlink:from="loc_us-gaap_NonoperatingIncomeExpense_8a790e5d-2235-4d93-9db3-e3cc5cda9c6d" xlink:to="loc_us-gaap_OtherNonoperatingIncomeExpense_9e5613d5-c83c-4c9d-8842-144873e369fd" xlink:type="arc"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_OperatingIncomeLoss_edd85440-e69c-44dd-bcef-e0d59662872e" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_OperatingIncomeLoss"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_GrossProfit_df0e989d-b9a8-4da8-9830-0f5b1b54603b" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_GrossProfit"/>
    <link:calculationArc order="1" weight="1.0" xlink:arcrole="http://www.xbrl.org/2003/arcrole/summation-item" xlink:from="loc_us-gaap_OperatingIncomeLoss_edd85440-e69c-44dd-bcef-e0d59662872e" xlink:to="loc_us-gaap_GrossProfit_df0e989d-b9a8-4da8-9830-0f5b1b54603b" xlink:type="arc"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_OperatingExpenses_c833c349-dee9-470a-b387-cf88aff30767" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_OperatingExpenses"/>
    <link:calculationArc order="2" weight="-1.0" xlink:arcrole="http://www.xbrl.org/2003/arcrole/summation-item" xlink:from="loc_us-gaap_OperatingIncomeLoss_edd85440-e69c-44dd-bcef-e0d59662872e" xlink:to="loc_us-gaap_OperatingExpenses_c833c349-dee9-470a-b387-cf88aff30767" xlink:type="arc"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_ProfitLoss_9ecad4a8-c3fd-4701-a560-6dab1fb3a3d9" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_ProfitLoss"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_IncomeTaxExpenseBenefit_2200fd2c-f6b9-4d70-8d23-d7a4cfdc9df8" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_IncomeTaxExpenseBenefit"/>
    <link:calculationArc order="1" weight="-1.0" xlink:arcrole="http://www.xbrl.org/2003/arcrole/summation-item" xlink:from="loc_us-gaap_ProfitLoss_9ecad4a8-c3fd-4701-a560-6dab1fb3a3d9" xlink:to="loc_us-gaap_IncomeTaxExpenseBenefit_2200fd2c-f6b9-4d70-8d23-d7a4cfdc9df8" xlink:type="arc"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_IncomeLossFromContinuingOperationsBeforeIncomeTaxesExtraordinaryItemsNoncontrollingInterest_4739f60e-ae7f-45b7-bb4a-990f8b0dda8d" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_IncomeLossFromContinuingOperationsBeforeIncomeTaxesExtraordinaryItemsNoncontrollingInterest"/>
    <link:calculationArc order="2" weight="1.0" xlink:arcrole="http://www.xbrl.org/2003/arcrole/summation-item" xlink:from="loc_us-gaap_ProfitLoss_9ecad4a8-c3fd-4701-a560-6dab1fb3a3d9" xlink:to="loc_us-gaap_IncomeLossFromContinuingOperationsBeforeIncomeTaxesExtraordinaryItemsNoncontrollingInterest_4739f60e-ae7f-45b7-bb4a-990f8b0dda8d" xlink:type="arc"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_OperatingExpenses_48f17901-ca0e-4eb2-88ea-7629ed4a3b57" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_OperatingExpenses"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_RestructuringSettlementAndImpairmentProvisions_2c378473-1d01-4bd0-a6fc-1d9f308757f7" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_RestructuringSettlementAndImpairmentProvisions"/>
    <link:calculationArc order="1" weight="1.0" xlink:arcrole="http://www.xbrl.org/2003/arcrole/summation-item" xlink:from="loc_us-gaap_OperatingExpenses_48f17901-ca0e-4eb2-88ea-7629ed4a3b57" xlink:to="loc_us-gaap_RestructuringSettlementAndImpairmentProvisions_2c378473-1d01-4bd0-a6fc-1d9f308757f7" xlink:type="arc"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_SellingGeneralAndAdministrativeExpense_613a5e3f-c6e2-43dd-87ca-68f45ecfcf2b" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_SellingGeneralAndAdministrativeExpense"/>
    <link:calculationArc order="2" weight="1.0" xlink:arcrole="http://www.xbrl.org/2003/arcrole/summation-item" xlink:from="loc_us-gaap_OperatingExpenses_48f17901-ca0e-4eb2-88ea-7629ed4a3b57" xlink:to="loc_us-gaap_SellingGeneralAndAdministrativeExpense_613a5e3f-c6e2-43dd-87ca-68f45ecfcf2b" xlink:type="arc"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_ResearchAndDevelopmentExpense_ca4098fb-df0a-4f3b-990a-8e40450be3be" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_ResearchAndDevelopmentExpense"/>
    <link:calculationArc order="3" weight="1.0" xlink:arcrole="http://www.xbrl.org/2003/arcrole/summation-item" xlink:from="loc_us-gaap_OperatingExpenses_48f17901-ca0e-4eb2-88ea-7629ed4a3b57" xlink:to="loc_us-gaap_ResearchAndDevelopmentExpense_ca4098fb-df0a-4f3b-990a-8e40450be3be" xlink:type="arc"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_GrossProfit_825a372d-0a6d-4463-a221-d06427c93a5b" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_GrossProfit"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_RevenueFromContractWithCustomerExcludingAssessedTax_b438def9-f7c0-4865-a1d0-908004beba26" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_RevenueFromContractWithCustomerExcludingAssessedTax"/>
    <link:calculationArc order="1" weight="1.0" xlink:arcrole="http://www.xbrl.org/2003/arcrole/summation-item" xlink:from="loc_us-gaap_GrossProfit_825a372d-0a6d-4463-a221-d06427c93a5b" xlink:to="loc_us-gaap_RevenueFromContractWithCustomerExcludingAssessedTax_b438def9-f7c0-4865-a1d0-908004beba26" xlink:type="arc"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_CostOfGoodsAndServicesSold_405a5466-d803-4788-9f7c-ab381642879f" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_CostOfGoodsAndServicesSold"/>
    <link:calculationArc order="2" weight="-1.0" xlink:arcrole="http://www.xbrl.org/2003/arcrole/summation-item" xlink:from="loc_us-gaap_GrossProfit_825a372d-0a6d-4463-a221-d06427c93a5b" xlink:to="loc_us-gaap_CostOfGoodsAndServicesSold_405a5466-d803-4788-9f7c-ab381642879f" xlink:type="arc"/>
  </link:calculationLink>
  <link:roleRef roleURI="http://www.sanmina.com/role/CondensedConsolidatedStatementofComprehensiveIncomeLoss" xlink:type="simple" xlink:href="sanm-20231230.xsd#CondensedConsolidatedStatementofComprehensiveIncomeLoss"/>
  <link:calculationLink xlink:role="http://www.sanmina.com/role/CondensedConsolidatedStatementofComprehensiveIncomeLoss" xlink:type="extended">
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_OtherComprehensiveIncomeLossNetOfTax_29283e47-782d-4747-a280-3190c8d2fe09" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_OtherComprehensiveIncomeLossNetOfTax"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_OtherComprehensiveIncomeLossCashFlowHedgeGainLossBeforeReclassificationAfterTax_f599be51-6720-4b6a-9754-74e0fd97a2f2" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_OtherComprehensiveIncomeLossCashFlowHedgeGainLossBeforeReclassificationAfterTax"/>
    <link:calculationArc order="1" weight="1.0" xlink:arcrole="http://www.xbrl.org/2003/arcrole/summation-item" xlink:from="loc_us-gaap_OtherComprehensiveIncomeLossNetOfTax_29283e47-782d-4747-a280-3190c8d2fe09" xlink:to="loc_us-gaap_OtherComprehensiveIncomeLossCashFlowHedgeGainLossBeforeReclassificationAfterTax_f599be51-6720-4b6a-9754-74e0fd97a2f2" xlink:type="arc"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_OtherComprehensiveIncomeLossForeignCurrencyTransactionAndTranslationAdjustmentNetOfTax_68865fd5-4654-4a05-ba28-ced414fc2996" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_OtherComprehensiveIncomeLossForeignCurrencyTransactionAndTranslationAdjustmentNetOfTax"/>
    <link:calculationArc order="2" weight="1.0" xlink:arcrole="http://www.xbrl.org/2003/arcrole/summation-item" xlink:from="loc_us-gaap_OtherComprehensiveIncomeLossNetOfTax_29283e47-782d-4747-a280-3190c8d2fe09" xlink:to="loc_us-gaap_OtherComprehensiveIncomeLossForeignCurrencyTransactionAndTranslationAdjustmentNetOfTax_68865fd5-4654-4a05-ba28-ced414fc2996" xlink:type="arc"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_OtherComprehensiveIncomeLossReclassificationAdjustmentFromAOCIPensionAndOtherPostretirementBenefitPlansNetOfTax_b003e976-aa39-4ef3-a209-bc41e0edd3f2" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_OtherComprehensiveIncomeLossReclassificationAdjustmentFromAOCIPensionAndOtherPostretirementBenefitPlansNetOfTax"/>
    <link:calculationArc order="3" weight="1.0" xlink:arcrole="http://www.xbrl.org/2003/arcrole/summation-item" xlink:from="loc_us-gaap_OtherComprehensiveIncomeLossNetOfTax_29283e47-782d-4747-a280-3190c8d2fe09" xlink:to="loc_us-gaap_OtherComprehensiveIncomeLossReclassificationAdjustmentFromAOCIPensionAndOtherPostretirementBenefitPlansNetOfTax_b003e976-aa39-4ef3-a209-bc41e0edd3f2" xlink:type="arc"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_OtherComprehensiveIncomeLossPensionAndOtherPostretirementBenefitPlansAdjustmentBeforeReclassificationAdjustmentsNetOfTax_cd16801e-5673-4a0b-a520-1a6add1d22c6" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_OtherComprehensiveIncomeLossPensionAndOtherPostretirementBenefitPlansAdjustmentBeforeReclassificationAdjustmentsNetOfTax"/>
    <link:calculationArc order="4" weight="-1.0" xlink:arcrole="http://www.xbrl.org/2003/arcrole/summation-item" xlink:from="loc_us-gaap_OtherComprehensiveIncomeLossNetOfTax_29283e47-782d-4747-a280-3190c8d2fe09" xlink:to="loc_us-gaap_OtherComprehensiveIncomeLossPensionAndOtherPostretirementBenefitPlansAdjustmentBeforeReclassificationAdjustmentsNetOfTax_cd16801e-5673-4a0b-a520-1a6add1d22c6" xlink:type="arc"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_OtherComprehensiveIncomeLossCashFlowHedgeGainLossReclassificationAfterTax_f5873ab9-ef1e-4316-871a-749e41cc0c74" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_OtherComprehensiveIncomeLossCashFlowHedgeGainLossReclassificationAfterTax"/>
    <link:calculationArc order="5" weight="-1.0" xlink:arcrole="http://www.xbrl.org/2003/arcrole/summation-item" xlink:from="loc_us-gaap_OtherComprehensiveIncomeLossNetOfTax_29283e47-782d-4747-a280-3190c8d2fe09" xlink:to="loc_us-gaap_OtherComprehensiveIncomeLossCashFlowHedgeGainLossReclassificationAfterTax_f5873ab9-ef1e-4316-871a-749e41cc0c74" xlink:type="arc"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_ComprehensiveIncomeNetOfTax_85c8e600-e652-4a58-84b9-a1148504da41" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_ComprehensiveIncomeNetOfTax"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_NetIncomeLossAttributableToNoncontrollingInterest_ca5964f2-0205-4b05-9706-7cb414fffaeb" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_NetIncomeLossAttributableToNoncontrollingInterest"/>
    <link:calculationArc order="1" weight="-1.0" xlink:arcrole="http://www.xbrl.org/2003/arcrole/summation-item" xlink:from="loc_us-gaap_ComprehensiveIncomeNetOfTax_85c8e600-e652-4a58-84b9-a1148504da41" xlink:to="loc_us-gaap_NetIncomeLossAttributableToNoncontrollingInterest_ca5964f2-0205-4b05-9706-7cb414fffaeb" xlink:type="arc"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_ComprehensiveIncomeNetOfTaxIncludingPortionAttributableToNoncontrollingInterest_a0fb6d70-b4a7-4c76-b0db-25945bd7d46a" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_ComprehensiveIncomeNetOfTaxIncludingPortionAttributableToNoncontrollingInterest"/>
    <link:calculationArc order="2" weight="1.0" xlink:arcrole="http://www.xbrl.org/2003/arcrole/summation-item" xlink:from="loc_us-gaap_ComprehensiveIncomeNetOfTax_85c8e600-e652-4a58-84b9-a1148504da41" xlink:to="loc_us-gaap_ComprehensiveIncomeNetOfTaxIncludingPortionAttributableToNoncontrollingInterest_a0fb6d70-b4a7-4c76-b0db-25945bd7d46a" xlink:type="arc"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_ComprehensiveIncomeNetOfTaxIncludingPortionAttributableToNoncontrollingInterest_e9a05eaf-a129-48b1-9e02-82ce36119abb" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_ComprehensiveIncomeNetOfTaxIncludingPortionAttributableToNoncontrollingInterest"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_ProfitLoss_f8b8cdb4-1115-4606-acef-48166ac14618" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_ProfitLoss"/>
    <link:calculationArc order="1" weight="1.0" xlink:arcrole="http://www.xbrl.org/2003/arcrole/summation-item" xlink:from="loc_us-gaap_ComprehensiveIncomeNetOfTaxIncludingPortionAttributableToNoncontrollingInterest_e9a05eaf-a129-48b1-9e02-82ce36119abb" xlink:to="loc_us-gaap_ProfitLoss_f8b8cdb4-1115-4606-acef-48166ac14618" xlink:type="arc"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_OtherComprehensiveIncomeLossNetOfTax_9f86fe29-94a1-406a-80dd-4202e9636b4b" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_OtherComprehensiveIncomeLossNetOfTax"/>
    <link:calculationArc order="2" weight="1.0" xlink:arcrole="http://www.xbrl.org/2003/arcrole/summation-item" xlink:from="loc_us-gaap_ComprehensiveIncomeNetOfTaxIncludingPortionAttributableToNoncontrollingInterest_e9a05eaf-a129-48b1-9e02-82ce36119abb" xlink:to="loc_us-gaap_OtherComprehensiveIncomeLossNetOfTax_9f86fe29-94a1-406a-80dd-4202e9636b4b" xlink:type="arc"/>
  </link:calculationLink>
  <link:roleRef roleURI="http://www.sanmina.com/role/CondensedConsolidatedStatementsofCashFlows" xlink:type="simple" xlink:href="sanm-20231230.xsd#CondensedConsolidatedStatementsofCashFlows"/>
  <link:calculationLink xlink:role="http://www.sanmina.com/role/CondensedConsolidatedStatementsofCashFlows" xlink:type="extended">
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_NetCashProvidedByUsedInInvestingActivities_ebaf423c-5ba7-48e1-8bec-03bce4819ff8" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_NetCashProvidedByUsedInInvestingActivities"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_PaymentsForProceedsFromOtherInvestingActivities_748bc44b-5fc7-4973-8971-047dc6e72b55" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_PaymentsForProceedsFromOtherInvestingActivities"/>
    <link:calculationArc order="1" weight="-1.0" xlink:arcrole="http://www.xbrl.org/2003/arcrole/summation-item" xlink:from="loc_us-gaap_NetCashProvidedByUsedInInvestingActivities_ebaf423c-5ba7-48e1-8bec-03bce4819ff8" xlink:to="loc_us-gaap_PaymentsForProceedsFromOtherInvestingActivities_748bc44b-5fc7-4973-8971-047dc6e72b55" xlink:type="arc"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_PaymentsToAcquirePropertyPlantAndEquipment_bc7fb73b-8097-4a5b-a4e2-5fa05521d6f7" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_PaymentsToAcquirePropertyPlantAndEquipment"/>
    <link:calculationArc order="2" weight="-1.0" xlink:arcrole="http://www.xbrl.org/2003/arcrole/summation-item" xlink:from="loc_us-gaap_NetCashProvidedByUsedInInvestingActivities_ebaf423c-5ba7-48e1-8bec-03bce4819ff8" xlink:to="loc_us-gaap_PaymentsToAcquirePropertyPlantAndEquipment_bc7fb73b-8097-4a5b-a4e2-5fa05521d6f7" xlink:type="arc"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_CashCashEquivalentsRestrictedCashAndRestrictedCashEquivalentsPeriodIncreaseDecreaseIncludingExchangeRateEffect_78a63e3f-ccca-487c-8a2d-c957367d84b6" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_CashCashEquivalentsRestrictedCashAndRestrictedCashEquivalentsPeriodIncreaseDecreaseIncludingExchangeRateEffect"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_NetCashProvidedByUsedInOperatingActivities_db9f0c35-4c41-49e3-be05-d31584b0a454" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_NetCashProvidedByUsedInOperatingActivities"/>
    <link:calculationArc order="1" weight="1.0" xlink:arcrole="http://www.xbrl.org/2003/arcrole/summation-item" xlink:from="loc_us-gaap_CashCashEquivalentsRestrictedCashAndRestrictedCashEquivalentsPeriodIncreaseDecreaseIncludingExchangeRateEffect_78a63e3f-ccca-487c-8a2d-c957367d84b6" xlink:to="loc_us-gaap_NetCashProvidedByUsedInOperatingActivities_db9f0c35-4c41-49e3-be05-d31584b0a454" xlink:type="arc"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_NetCashProvidedByUsedInInvestingActivities_76ff52d1-975f-4b2d-8b12-8c57a4604567" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_NetCashProvidedByUsedInInvestingActivities"/>
    <link:calculationArc order="2" weight="1.0" xlink:arcrole="http://www.xbrl.org/2003/arcrole/summation-item" xlink:from="loc_us-gaap_CashCashEquivalentsRestrictedCashAndRestrictedCashEquivalentsPeriodIncreaseDecreaseIncludingExchangeRateEffect_78a63e3f-ccca-487c-8a2d-c957367d84b6" xlink:to="loc_us-gaap_NetCashProvidedByUsedInInvestingActivities_76ff52d1-975f-4b2d-8b12-8c57a4604567" xlink:type="arc"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_NetCashProvidedByUsedInFinancingActivities_8b78f262-78da-47cd-8382-d26f2ce6d57a" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_NetCashProvidedByUsedInFinancingActivities"/>
    <link:calculationArc order="3" weight="1.0" xlink:arcrole="http://www.xbrl.org/2003/arcrole/summation-item" xlink:from="loc_us-gaap_CashCashEquivalentsRestrictedCashAndRestrictedCashEquivalentsPeriodIncreaseDecreaseIncludingExchangeRateEffect_78a63e3f-ccca-487c-8a2d-c957367d84b6" xlink:to="loc_us-gaap_NetCashProvidedByUsedInFinancingActivities_8b78f262-78da-47cd-8382-d26f2ce6d57a" xlink:type="arc"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_EffectOfExchangeRateOnCashCashEquivalentsRestrictedCashAndRestrictedCashEquivalents_7071b7e6-b040-4e14-957f-1bec507c07cd" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_EffectOfExchangeRateOnCashCashEquivalentsRestrictedCashAndRestrictedCashEquivalents"/>
    <link:calculationArc order="4" weight="1.0" xlink:arcrole="http://www.xbrl.org/2003/arcrole/summation-item" xlink:from="loc_us-gaap_CashCashEquivalentsRestrictedCashAndRestrictedCashEquivalentsPeriodIncreaseDecreaseIncludingExchangeRateEffect_78a63e3f-ccca-487c-8a2d-c957367d84b6" xlink:to="loc_us-gaap_EffectOfExchangeRateOnCashCashEquivalentsRestrictedCashAndRestrictedCashEquivalents_7071b7e6-b040-4e14-957f-1bec507c07cd" xlink:type="arc"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_NetCashProvidedByUsedInFinancingActivities_ccd9dbe6-7216-4115-9aa3-8778768c7bc7" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_NetCashProvidedByUsedInFinancingActivities"/>
    <link:loc xlink:type="locator" xlink:label="loc_sanm_RepurchasesOfCommonStockIncludingExciseTax_44a075e9-c13c-47fb-9406-a50031be122e" xlink:href="sanm-20231230.xsd#sanm_RepurchasesOfCommonStockIncludingExciseTax"/>
    <link:calculationArc order="1" weight="-1.0" xlink:arcrole="http://www.xbrl.org/2003/arcrole/summation-item" xlink:from="loc_us-gaap_NetCashProvidedByUsedInFinancingActivities_ccd9dbe6-7216-4115-9aa3-8778768c7bc7" xlink:to="loc_sanm_RepurchasesOfCommonStockIncludingExciseTax_44a075e9-c13c-47fb-9406-a50031be122e" xlink:type="arc"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_ProceedsFromLinesOfCredit_16f68468-b5b7-4a1b-9932-c14e25feac3b" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_ProceedsFromLinesOfCredit"/>
    <link:calculationArc order="2" weight="1.0" xlink:arcrole="http://www.xbrl.org/2003/arcrole/summation-item" xlink:from="loc_us-gaap_NetCashProvidedByUsedInFinancingActivities_ccd9dbe6-7216-4115-9aa3-8778768c7bc7" xlink:to="loc_us-gaap_ProceedsFromLinesOfCredit_16f68468-b5b7-4a1b-9932-c14e25feac3b" xlink:type="arc"/>
    <link:loc xlink:type="locator" xlink:label="loc_sanm_ProceedsFromSaleOfNoncontrollingInterest_1fcbfec6-2e76-4162-b4c4-551c2d436dc8" xlink:href="sanm-20231230.xsd#sanm_ProceedsFromSaleOfNoncontrollingInterest"/>
    <link:calculationArc order="3" weight="1.0" xlink:arcrole="http://www.xbrl.org/2003/arcrole/summation-item" xlink:from="loc_us-gaap_NetCashProvidedByUsedInFinancingActivities_ccd9dbe6-7216-4115-9aa3-8778768c7bc7" xlink:to="loc_sanm_ProceedsFromSaleOfNoncontrollingInterest_1fcbfec6-2e76-4162-b4c4-551c2d436dc8" xlink:type="arc"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_RepaymentsOfLinesOfCredit_43e2f394-5bcc-4aed-833e-79bbd4e6e308" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_RepaymentsOfLinesOfCredit"/>
    <link:calculationArc order="4" weight="-1.0" xlink:arcrole="http://www.xbrl.org/2003/arcrole/summation-item" xlink:from="loc_us-gaap_NetCashProvidedByUsedInFinancingActivities_ccd9dbe6-7216-4115-9aa3-8778768c7bc7" xlink:to="loc_us-gaap_RepaymentsOfLinesOfCredit_43e2f394-5bcc-4aed-833e-79bbd4e6e308" xlink:type="arc"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_ProceedsFromIssuanceOfSharesUnderIncentiveAndShareBasedCompensationPlansIncludingStockOptions_18c9ba22-baf2-492c-b06d-4143aa0f1540" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_ProceedsFromIssuanceOfSharesUnderIncentiveAndShareBasedCompensationPlansIncludingStockOptions"/>
    <link:calculationArc order="5" weight="1.0" xlink:arcrole="http://www.xbrl.org/2003/arcrole/summation-item" xlink:from="loc_us-gaap_NetCashProvidedByUsedInFinancingActivities_ccd9dbe6-7216-4115-9aa3-8778768c7bc7" xlink:to="loc_us-gaap_ProceedsFromIssuanceOfSharesUnderIncentiveAndShareBasedCompensationPlansIncludingStockOptions_18c9ba22-baf2-492c-b06d-4143aa0f1540" xlink:type="arc"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_PaymentsForRepurchaseOfCommonStock_b114ae68-2456-4d0b-b124-fc7d47bb2d68" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_PaymentsForRepurchaseOfCommonStock"/>
    <link:calculationArc order="6" weight="-1.0" xlink:arcrole="http://www.xbrl.org/2003/arcrole/summation-item" xlink:from="loc_us-gaap_NetCashProvidedByUsedInFinancingActivities_ccd9dbe6-7216-4115-9aa3-8778768c7bc7" xlink:to="loc_us-gaap_PaymentsForRepurchaseOfCommonStock_b114ae68-2456-4d0b-b124-fc7d47bb2d68" xlink:type="arc"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_RepaymentsOfDebt_b35daac6-383d-4a4c-92dc-79b9ea74bb8b" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_RepaymentsOfDebt"/>
    <link:calculationArc order="7" weight="-1.0" xlink:arcrole="http://www.xbrl.org/2003/arcrole/summation-item" xlink:from="loc_us-gaap_NetCashProvidedByUsedInFinancingActivities_ccd9dbe6-7216-4115-9aa3-8778768c7bc7" xlink:to="loc_us-gaap_RepaymentsOfDebt_b35daac6-383d-4a4c-92dc-79b9ea74bb8b" xlink:type="arc"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_NetCashProvidedByUsedInOperatingActivities_f5eba608-e5ca-43e7-86ef-0470ee4b7450" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_NetCashProvidedByUsedInOperatingActivities"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_ShareBasedCompensation_55124858-9334-4fab-8d21-787ba9c0ec97" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_ShareBasedCompensation"/>
    <link:calculationArc order="1" weight="1.0" xlink:arcrole="http://www.xbrl.org/2003/arcrole/summation-item" xlink:from="loc_us-gaap_NetCashProvidedByUsedInOperatingActivities_f5eba608-e5ca-43e7-86ef-0470ee4b7450" xlink:to="loc_us-gaap_ShareBasedCompensation_55124858-9334-4fab-8d21-787ba9c0ec97" xlink:type="arc"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_IncreaseDecreaseInContractWithCustomerAsset_bd6c6b0b-4ea3-4ea2-9857-e3467d8bed9c" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_IncreaseDecreaseInContractWithCustomerAsset"/>
    <link:calculationArc order="2" weight="-1.0" xlink:arcrole="http://www.xbrl.org/2003/arcrole/summation-item" xlink:from="loc_us-gaap_NetCashProvidedByUsedInOperatingActivities_f5eba608-e5ca-43e7-86ef-0470ee4b7450" xlink:to="loc_us-gaap_IncreaseDecreaseInContractWithCustomerAsset_bd6c6b0b-4ea3-4ea2-9857-e3467d8bed9c" xlink:type="arc"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_IncreaseDecreaseInAccountsPayable_244ce325-fd1c-4fd7-acd5-09dc3778b2de" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_IncreaseDecreaseInAccountsPayable"/>
    <link:calculationArc order="3" weight="1.0" xlink:arcrole="http://www.xbrl.org/2003/arcrole/summation-item" xlink:from="loc_us-gaap_NetCashProvidedByUsedInOperatingActivities_f5eba608-e5ca-43e7-86ef-0470ee4b7450" xlink:to="loc_us-gaap_IncreaseDecreaseInAccountsPayable_244ce325-fd1c-4fd7-acd5-09dc3778b2de" xlink:type="arc"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_IncreaseDecreaseInPrepaidDeferredExpenseAndOtherAssets_0b6b8282-77ce-4ba0-bbcc-25f9a353c936" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_IncreaseDecreaseInPrepaidDeferredExpenseAndOtherAssets"/>
    <link:calculationArc order="4" weight="-1.0" xlink:arcrole="http://www.xbrl.org/2003/arcrole/summation-item" xlink:from="loc_us-gaap_NetCashProvidedByUsedInOperatingActivities_f5eba608-e5ca-43e7-86ef-0470ee4b7450" xlink:to="loc_us-gaap_IncreaseDecreaseInPrepaidDeferredExpenseAndOtherAssets_0b6b8282-77ce-4ba0-bbcc-25f9a353c936" xlink:type="arc"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_IncreaseDecreaseInInventories_b7152313-a411-4bfe-8680-f8c00f67351b" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_IncreaseDecreaseInInventories"/>
    <link:calculationArc order="5" weight="-1.0" xlink:arcrole="http://www.xbrl.org/2003/arcrole/summation-item" xlink:from="loc_us-gaap_NetCashProvidedByUsedInOperatingActivities_f5eba608-e5ca-43e7-86ef-0470ee4b7450" xlink:to="loc_us-gaap_IncreaseDecreaseInInventories_b7152313-a411-4bfe-8680-f8c00f67351b" xlink:type="arc"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_IncreaseDecreaseInAccountsReceivable_45eb68da-01b4-4ebf-9133-ba9c2cc20555" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_IncreaseDecreaseInAccountsReceivable"/>
    <link:calculationArc order="6" weight="-1.0" xlink:arcrole="http://www.xbrl.org/2003/arcrole/summation-item" xlink:from="loc_us-gaap_NetCashProvidedByUsedInOperatingActivities_f5eba608-e5ca-43e7-86ef-0470ee4b7450" xlink:to="loc_us-gaap_IncreaseDecreaseInAccountsReceivable_45eb68da-01b4-4ebf-9133-ba9c2cc20555" xlink:type="arc"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_IncreaseDecreaseInOtherOperatingLiabilities_bd214a99-dae1-48a0-823c-8dd9a7264d73" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_IncreaseDecreaseInOtherOperatingLiabilities"/>
    <link:calculationArc order="7" weight="1.0" xlink:arcrole="http://www.xbrl.org/2003/arcrole/summation-item" xlink:from="loc_us-gaap_NetCashProvidedByUsedInOperatingActivities_f5eba608-e5ca-43e7-86ef-0470ee4b7450" xlink:to="loc_us-gaap_IncreaseDecreaseInOtherOperatingLiabilities_bd214a99-dae1-48a0-823c-8dd9a7264d73" xlink:type="arc"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_DeferredIncomeTaxExpenseBenefit_942a449b-fb2a-46f1-bff9-08d3b3cb1935" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_DeferredIncomeTaxExpenseBenefit"/>
    <link:calculationArc order="8" weight="1.0" xlink:arcrole="http://www.xbrl.org/2003/arcrole/summation-item" xlink:from="loc_us-gaap_NetCashProvidedByUsedInOperatingActivities_f5eba608-e5ca-43e7-86ef-0470ee4b7450" xlink:to="loc_us-gaap_DeferredIncomeTaxExpenseBenefit_942a449b-fb2a-46f1-bff9-08d3b3cb1935" xlink:type="arc"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_ProfitLoss_ff8dff70-ea3e-48a7-ace4-522de92a4020" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_ProfitLoss"/>
    <link:calculationArc order="9" weight="1.0" xlink:arcrole="http://www.xbrl.org/2003/arcrole/summation-item" xlink:from="loc_us-gaap_NetCashProvidedByUsedInOperatingActivities_f5eba608-e5ca-43e7-86ef-0470ee4b7450" xlink:to="loc_us-gaap_ProfitLoss_ff8dff70-ea3e-48a7-ace4-522de92a4020" xlink:type="arc"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_OtherOperatingActivitiesCashFlowStatement_13235d98-db65-4ba9-8b77-82cb22a52d00" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_OtherOperatingActivitiesCashFlowStatement"/>
    <link:calculationArc order="10" weight="1.0" xlink:arcrole="http://www.xbrl.org/2003/arcrole/summation-item" xlink:from="loc_us-gaap_NetCashProvidedByUsedInOperatingActivities_f5eba608-e5ca-43e7-86ef-0470ee4b7450" xlink:to="loc_us-gaap_OtherOperatingActivitiesCashFlowStatement_13235d98-db65-4ba9-8b77-82cb22a52d00" xlink:type="arc"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_DepreciationDepletionAndAmortization_772a7492-b9a8-404f-85d5-74a36aba95a8" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_DepreciationDepletionAndAmortization"/>
    <link:calculationArc order="11" weight="1.0" xlink:arcrole="http://www.xbrl.org/2003/arcrole/summation-item" xlink:from="loc_us-gaap_NetCashProvidedByUsedInOperatingActivities_f5eba608-e5ca-43e7-86ef-0470ee4b7450" xlink:to="loc_us-gaap_DepreciationDepletionAndAmortization_772a7492-b9a8-404f-85d5-74a36aba95a8" xlink:type="arc"/>
  </link:calculationLink>
  <link:roleRef roleURI="http://www.sanmina.com/role/STOCKHOLDERSEQUITYDetails" xlink:type="simple" xlink:href="sanm-20231230.xsd#STOCKHOLDERSEQUITYDetails"/>
  <link:calculationLink xlink:role="http://www.sanmina.com/role/STOCKHOLDERSEQUITYDetails" xlink:type="extended">
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_AccumulatedOtherComprehensiveIncomeLossNetOfTax_915e9569-f284-4629-8339-42566aa3b301" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_AccumulatedOtherComprehensiveIncomeLossNetOfTax"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_AccumulatedOtherComprehensiveIncomeLossForeignCurrencyTranslationAdjustmentNetOfTax_82347576-b2e2-4bde-9af9-4faaaa38b122" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_AccumulatedOtherComprehensiveIncomeLossForeignCurrencyTranslationAdjustmentNetOfTax"/>
    <link:calculationArc order="1" weight="1.0" xlink:arcrole="http://www.xbrl.org/2003/arcrole/summation-item" xlink:from="loc_us-gaap_AccumulatedOtherComprehensiveIncomeLossNetOfTax_915e9569-f284-4629-8339-42566aa3b301" xlink:to="loc_us-gaap_AccumulatedOtherComprehensiveIncomeLossForeignCurrencyTranslationAdjustmentNetOfTax_82347576-b2e2-4bde-9af9-4faaaa38b122" xlink:type="arc"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_AociLossCashFlowHedgeCumulativeGainLossAfterTax_c70508f2-7174-459e-b57e-e27353aef59d" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_AociLossCashFlowHedgeCumulativeGainLossAfterTax"/>
    <link:calculationArc order="2" weight="1.0" xlink:arcrole="http://www.xbrl.org/2003/arcrole/summation-item" xlink:from="loc_us-gaap_AccumulatedOtherComprehensiveIncomeLossNetOfTax_915e9569-f284-4629-8339-42566aa3b301" xlink:to="loc_us-gaap_AociLossCashFlowHedgeCumulativeGainLossAfterTax_c70508f2-7174-459e-b57e-e27353aef59d" xlink:type="arc"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_AccumulatedOtherComprehensiveIncomeLossDefinedBenefitPensionAndOtherPostretirementPlansNetOfTax_80dd985d-9cd8-4063-a60f-6b34e32f171c" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_AccumulatedOtherComprehensiveIncomeLossDefinedBenefitPensionAndOtherPostretirementPlansNetOfTax"/>
    <link:calculationArc order="3" weight="-1.0" xlink:arcrole="http://www.xbrl.org/2003/arcrole/summation-item" xlink:from="loc_us-gaap_AccumulatedOtherComprehensiveIncomeLossNetOfTax_915e9569-f284-4629-8339-42566aa3b301" xlink:to="loc_us-gaap_AccumulatedOtherComprehensiveIncomeLossDefinedBenefitPensionAndOtherPostretirementPlansNetOfTax_80dd985d-9cd8-4063-a60f-6b34e32f171c" xlink:type="arc"/>
  </link:calculationLink>
  <link:roleRef roleURI="http://www.sanmina.com/role/EARNINGSPERSHAREDetails" xlink:type="simple" xlink:href="sanm-20231230.xsd#EARNINGSPERSHAREDetails"/>
  <link:calculationLink xlink:role="http://www.sanmina.com/role/EARNINGSPERSHAREDetails" xlink:type="extended">
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_WeightedAverageNumberOfDilutedSharesOutstanding_b1a20f0b-2c92-4bac-86d5-0b0252282ee7" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_WeightedAverageNumberOfDilutedSharesOutstanding"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_WeightedAverageNumberOfSharesOutstandingBasic_783f2d5c-c28d-4de4-b9a0-30d5ba8f1402" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_WeightedAverageNumberOfSharesOutstandingBasic"/>
    <link:calculationArc order="1" weight="1.0" xlink:arcrole="http://www.xbrl.org/2003/arcrole/summation-item" xlink:from="loc_us-gaap_WeightedAverageNumberOfDilutedSharesOutstanding_b1a20f0b-2c92-4bac-86d5-0b0252282ee7" xlink:to="loc_us-gaap_WeightedAverageNumberOfSharesOutstandingBasic_783f2d5c-c28d-4de4-b9a0-30d5ba8f1402" xlink:type="arc"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_WeightedAverageNumberDilutedSharesOutstandingAdjustment_0c40c6a6-30d4-4447-a42b-1dce35ef6572" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_WeightedAverageNumberDilutedSharesOutstandingAdjustment"/>
    <link:calculationArc order="2" weight="1.0" xlink:arcrole="http://www.xbrl.org/2003/arcrole/summation-item" xlink:from="loc_us-gaap_WeightedAverageNumberOfDilutedSharesOutstanding_b1a20f0b-2c92-4bac-86d5-0b0252282ee7" xlink:to="loc_us-gaap_WeightedAverageNumberDilutedSharesOutstandingAdjustment_0c40c6a6-30d4-4447-a42b-1dce35ef6572" xlink:type="arc"/>
  </link:calculationLink>
</link:linkbase>
